[nem-en] My thoughts on Nemerle

Kamil Skalski kamil.skalski at gmail.com
Sun Jan 8 21:39:35 CET 2006


> >
> C# 3.0 only allows extension parameters on first place, like the first
> example. Indeed, they just add an [Extension] attribute to both class
> and method, and substitute all references of this with this first parameter.
> Maybe at some compiler stage (isn't there a stage where all types are
> inspected making a tree of methods?), we could add methods marked with
> [Extension] to the correct branch of the tree.

Yes, those are things todo during implementation.

> About specifying "this", the only problem I see is that then, on the
> method code, you have to substitute all references of this with the
> actual parameters, which I find really painful (and on my point of view,
> non-sense)

Ah, does it mean that this "extension" parameter is refered to as 'this'? Like:
module Ex {
   public ListSplit (this x : string) : list [char] {
       List.FromArray (this.Split())
   }
}


This looks really ugly... and one more thing to implement... I would
prefer just using 'x'.

> >
> >I'm not sure: while this seems cleaner, forcing people to write ten more
> >'using's in front of their file may not be that good idea.
> >
> Maybe both?
>

Hm, making 'using Namespace' enable all extension methods in scope
already opens also the classes.

>
> I also fin useful to allow, in some Spec#-style, non-null parameters, so
> method (T : string!) {
>  ...
> }
>
> would mean
>
> method (T : string) {
>   if (T == null) throw ArgumentNullException();
>   ...
> }

Ah, we have Nemerle.Assertions.NotNull, which does exactly that. The
syntax you proposed would be nice for making this macro's usage
shorter.


>
>
> ______________________________________________
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y moviles desde 1 centimo por minuto.
> http://es.voice.yahoo.com
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>


--
Kamil Skalski
http://nazgul.omega.pl



More information about the devel-en mailing list