[rust-dev] 2 possible simplifications: reverse application, records as arguments

Kobi Lurie kobi2187 at gmail.com
Fri Apr 13 23:07:08 PDT 2012


such a flurry of activity here :-D

I saw a few things I liked, in the felix language (and some that are 
above my head for now.)

Do you think they fit rust well or not?

one is reverse application.
it's actually logical and might simplify things.
(similar to extension methods in c#)
there are no classes, but a syntax like: obj.method(b,c) still exists.
from what I could tell, the function is really method(obj,b,c), and the 
previous syntax gets translated to it. which is just nicer for the 
programmers, minimizing parentheses.

another thing is that instead of passing arguments, you pass just one 
(anonymous) record. the record is the arguments.
which means, that argument names become mandatory, and the order 
wouldn't matter.
or alternatively, a tuple, and then names don't matter. (personally I 
prefer the record with explicit names)
from the calling side it looks the same.

this is also very logical, as it's the same concept, but more refined.
the fields to use don't come after the fact, in a way you also design 
the arguments (as the record).

I'm not quite sure I make sense here, because it looks like you have the 
same benefits, but I think there's something to inquire here.

actually there is a third one, virtual sequences, as I saw in the factor 
programming language (which is a really cool language btw, very nicely done)
http://docs.factorcode.org/content/article-virtual-sequences.html

ok, enough talk in the air, let's actually put it to usage.
bye, kobi


More information about the Rust-dev mailing list