ssylvan, as a Lisper I would be in favor of having fn name(args) ...
desugar to let name = fn(args) ... where fn is essentially lambda.
Cheers,
Andrew Pennebaker
www.yellosoft.us
On Thu, Feb 16, 2012 at 10:11 PM, ssylvan <
reply+i-3256181-1278e5d081fb7d85e61536ab04aa4a1ed31f5d52-5...@reply.github.com
> wrote:
> How about go the other way and make the normal function definition just be
> a let statenent that binds a lambda of some sort?
>
> I really like the idea of unifying syntaxes though, but it's worth
> considering changing the declaration to be more like the expression,
> instead of going the other way. Also, it would be cool if there wasn't two
> ways to declare a function (either by using special-case function
> declaration syntax, or just creating a lambda, of some sort, and assining
> it to a variable).
>
> Maybe get rid of special function declarations, and do something like:
>
> ```
> // just declare a variable that happens to be a function...
> let foo = ( x : int ) -> int {
> x+5
> };
>
> // alternative form, do inference the other way, either would be legal
> let foo2 : (int) -> int = x {
> x+5
> };
>
> // full syntax, all types explicit, no inference
> let foo3 : (int)->int = (x : int) -> int {
> x+5
> };
> ```
>
> These all sort of look enough like function definitions, but are really
> just declaring a variable like any other.
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/mozilla/rust/issues/1854#issuecomment-4014461
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev