Closed AnthonyJacob closed 7 years ago
Because let
is translated to local variables in functions and is thus orders of magnitude faster than maps. The reason let
is usually needed in functional languages is to preserve sharing after beta-reduction. Note that if we didn't have let
, the proper way to express it would be with lambdas, i.e., let x = y in z
would be represented by ((x => z) y)
.
Could private
keyword solve that?
x = {
private fooo a b c = ... ,
foo a = fooo a " " ", " ,
}
x.fooo "a b c" " " ", " // throws an error, x does not have field fooo
x.foo "a b c" // returns "a, b, c"
In reality I would be for something less verbose, for example every name prefixed with _
would be private (eg _foo
is private).
That doesn't make a lot of sense to me, sorry :( I think let
is great on the short term. On the long term it will be replaced by (a => b) c
.
On the long term it will be replaced by (a => b) c.
Isnt that possible only with optimal evaluation strategy? Are we going to use Lamping's abstract algorithm for that?
Possible in what sense? I think removing let
would be ok even with just closures. But for example, without let
, how we can represent sharing on terms on normal form? It is important to represent sharing.
On the long term it will be replaced by (a => b) c.
I mean, why would you remove let and replace it with apply, if (as you said) we need let for sharing!
Why does moon-core contain Let constructor when it also has Map?
Both gives names to expressions. But
Map
can also group multiple expressions under the same name, providing a simple module system.