[nem-en] recursive types

Kamil Skalski nazgul at nemerle.org
Thu Sep 23 16:06:55 CEST 2004


On Thu, Sep 23, 2004 at 02:55:55PM +0200, Wiktor Zychla wrote:
> >   | Var( name ) =>
> >    when ( !a.Contains( name ) )
> >     a.Add( name );
> 
> I've found that cosuming the value of Add helps the compiler to accept the 
> code:
> 
>    | Var( name ) =>
>     when ( !a.Contains( name ) )
>        mutable dummy = 0;
>        dummy = a.Add( name );
> }

And that's almost the proper solution. :)

> 
> But this is awful! I still look for another solution.
> 
> Interestingly, following does not compile
> 
>    | Var( name ) =>
>     when ( !a.Contains( name ) )
>        mutable dummy = a.Add( name );
> }
> 
> with "let binding not followed by any expression".

Yes, we consider ignoring defined variable as an error.

Actually we are planning to add even better way of ignoring value 
than 'ignore' macro. It will look like
_ = a.Add (name);

which looks quite nice, like 'assigning' the value to some unnamed
'variable'.

Kamil 





More information about the devel-en mailing list