From a01935e96a1f3b7b6a51e2106f051dd940feb30f Mon Sep 17 00:00:00 2001 From: Alan Jeffrey <403333+asajeffrey@users.noreply.github.com> Date: Thu, 6 May 2021 09:09:10 -0500 Subject: [PATCH] Update rfcs/generic-functions.md Co-authored-by: Tiffany Bennett --- rfcs/generic-functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfcs/generic-functions.md b/rfcs/generic-functions.md index 954d9b95..6f85519a 100644 --- a/rfcs/generic-functions.md +++ b/rfcs/generic-functions.md @@ -8,7 +8,7 @@ Extend the syntax and semantics of functions to support explicit generic functio Currently Luau allows generic functions to be inferred but not given explicit type annotations. For example -``` +```lua function id(x) return x end local x: string = id("hi") local y: number = id(37) @@ -107,4 +107,4 @@ We did originally consider Rank-1 types, but the problem is that's not backward- We could introduce syntax for generic types without changing the semantics, but then there'd be a gap between the syntax (where the types `() -> (a) -> a` and `() -> (a) -> a` are different) and the semantics (where they are not). As noted above, this isn't sound. -Rather than using Rank-N types, we could use SML-style polymorphism, but this would need something like the [value restriction](http://users.cis.fiu.edu/~smithg/cop4555/valrestr.html) to be sound. \ No newline at end of file +Rather than using Rank-N types, we could use SML-style polymorphism, but this would need something like the [value restriction](http://users.cis.fiu.edu/~smithg/cop4555/valrestr.html) to be sound.