This would make deeply-nested HOF easier to read, but I'm not a fan of the way that `fn foo(->int) {` looks for functions with no arguments.
Because I forgot to register my opinion previously, I do like the way that the current syntax reads in the common case, including the use of the otherwise-idiosyncratic arrow symbol. "Call this function with these parameters, this type pops out." Coming from C-family languages and dynamic languages, I never gave the syntax for this a second thought. On Tue, Jul 30, 2013 at 12:50 AM, Uther <uther...@gmail.com> wrote: > I didn't raise the subject since it seems late for a huge syntax change > but if I had to change something about the function syntax I would change > it to: > > fn function (var: type, ... -> returnType) {...} > > I really think it would be more readable especially in the case of Brendan > Zabarauskas exemple : > > fn hof<T>(x: T, f: fn(T->T) -> fn(T->T)) { … } > > > Le 30/07/13 04:08, Brendan Zabarauskas a écrit : > > This would make function signatures harder to read in some instances, >> particularly when using closures and higher-order functions: >> >> let f: fn(T): T = …; >> >> fn hof<T>(x: T, f: fn(T): T): fn(T): T { … } >> >> Compare to the current syntax: >> >> let f: fn(T) -> T = …; >> >> fn hof<T>(x: T, f: fn(T) -> T) -> fn(T) -> T { … } >> >> ~Brendan >> >> On 30/07/2013, at 9:29 AM, Wojciech Miłkowski <milkow...@gmail.com> >> wrote: >> >> Hi, >>> >>> I'm observing rust development for some time, and I must say it slowly >>> encourages me to use it. Especially the progress from Perl-like syntax >>> to more sane and quiet form is enjoyable. >>> That said I wonder why the function definition has form: >>> fn name(var: type, ...) -> return_type {...} >>> instead of more unified: >>> fn name(var: type, ...): return_type {...} >>> >>> Is it constructed to mimic mathematical form f(x)->y or is there other >>> reason i.e. syntax ambiguity? >>> >>> >>> Cheers, >>> W. >>> ______________________________**_________________ >>> Rust-dev mailing list >>> Rust-dev@mozilla.org >>> https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev> >>> >> ______________________________**_________________ >> Rust-dev mailing list >> Rust-dev@mozilla.org >> https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev> >> > > ______________________________**_________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev> >
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev