[nem-en] 0000898: 'int' treated as an identifier even ifusedwithout verbatim specifier (@)

Kamil Skalski kamil.skalski at gmail.com
Tue Feb 20 19:52:46 CET 2007


In general this is useful to redefine constant variables:

def x = "1,2,3";
def x = x.Split (',');
def x = x.Map (int.Parse);
def x = x.FoldLeft (0, _ + _);

In case of redefining type name... this is quite common also in C# and
adding new type names should not in general break code using their
names as variable names:

create code:
///
def  Foo = "aa";
///

then after a week add:
///
class Foo { }
///

--->  oh, we now get compile error in weird places, which does not
have any connection with Foo




2007/2/20, vc <vc at rsdn.ru>:
> > But would it work only for variables introduced in matching's  'as'
> > pattern? Because if it is for any variable definitions, I don't this
> > it is a good idea.
>
> In mi option, bad idea is redefine implicitly any identifier.
> I like use spatial syntax for it. For example:
> redef int = 1;
> But, in case 'as' it's caused many problem and should be banned.
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>


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



More information about the devel-en mailing list