-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler: forbit let rec bindings within function body
Close #13
- Loading branch information
Showing
5 changed files
with
48 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
(* FIXME: Erlang does not support let rec bindings, and we're forced to use a | ||
combinator instead. | ||
Right now it believes that the name is supposed to be a module level | ||
function, which compiles fine but crashes at runtime. | ||
So this: | ||
let rec f x = f (x + 1) in | ||
f 0 | ||
could look like: | ||
let_rec() -> | ||
RecF = fun(G) -> fun (X) -> (G(G))(X+1) end end, | ||
F = RecF(RecF), | ||
F(0). | ||
alternatively we coudl wrap this in a support library too | ||
F = caramel:letrec1(fun (F, X) -> F(X + 1) end) | ||
*) | ||
let let_rec () = | ||
let rec f x = f (x + 1) in | ||
f 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters