[nem-en] My thoughts on Nemerle
Michal Moskal
michal.moskal at gmail.com
Sun Jan 8 09:25:39 CET 2006
On 1/7/06, Alejandro Serrano <trupill at yahoo.es> wrote:
> JUST-RETURN FUNCTIONS (LAMBDA EXPRESSIONS IN C#)
>
> I think function syntax is good in Nemerle. However, seen C# 3.0, I
> think its syntax for lambda expressions could be used for functions that
> just return values. I think it can be easiy achieved with:
>
> x => x.Name
>
> could be translated to
>
> fun (x) { x.Name }
>
> Maybe it would conflict with pattern matching?
I like this x => x.Name thing a lot more than fun (x) { x.Name } (though
this particular example is _.Name in Nemerle, which is even shorter).
> TYPE INITIALIZERS
>
> This is one of the features I would like the most to see in Nemerle.
> This is just about getting this in constructors:
>
> def r = Point() { X = 1, Y = 3 };
>
> to mean
>
> def r = Point();
> r.X = 1;
> r.Y = 3;
>
> Another syntax instead { ... } can be used, but I think you get the idea.
Just a minor point -- one software engineering problem I see here, is
that you have to make X and Y mutable, while they are not, conceptually.
This is why I like [Record] macro more. I'm not saying "no" of course.
> SQL-LIKE QUERY EXPRESSIONS
>
> This has two different parts. First of all, whether we should make lists
> System.Query-compatible or not.
> Second, if we should include something like query expressions in
> Nemerle. Maybe, a set of macros could make the work, so it can be easily
> done. The syntax can come from the one in C# spec.
>
> def c = from c in customers
> where c.City == "London"
> select c;
>
> Should translate to:
>
> def c = costumers.Where (fun (c) { c.City == "London" });
>
> But I find that list comprehensions can make its work:
>
> def c = $[c | c in costumers, c.City == "London"];
>
> although grouping and sorting cannot be achieved this way.
Maybe we could extend list comprehensions?
Or maybe just use
def c = $[c | c in costumers.Sort (), c.City == "London"];
Not sure about grouping though.
> TRAITS (http://nemerle.org/Traits)
>
> This seems some type of mega-interfaces, aren't they? I woudl prefer
> something like the implementation exposed in
> http://www.iam.unibe.ch/~scg/Archive/Projects/Reic05a.pdf. A set of
> attributes can be created for that aim. An implementation for Rotor can
> be found at http://www.iam.unibe.ch/~scg/Research/Rotor/index.html.
I'm the one who wrote this page in the first place (while listening to
the guy who implemented the thing in Redmond). I'm not sure they are all
that nice, they paint it, though we will probably never know without
first implementing and trying to use it ;)
> I will start a page on the wiki for it, aiming to make a "quick guide"
> for all Nemerle features, specially for people coming from C#
> (http://nemerle.org/Quick_Guide)
Just a general remark: I think we have very poor organization of
information on our webpage and the menu thing didn't help much.
But of course such a guide is great!
--
Michal Moskal,
http://nemerle.org/~malekith/
More information about the devel-en
mailing list