[nem-en] Re: Late Binding in Nemerle

Arthur Peters amp at singingwizard.org
Wed Jul 5 05:33:22 CEST 2006


I have been looking at this thread and I've had some thoughts that may
or may not be useful. BTW, I realized that some of this may not apply.
See the last 2 paragraphs.

Perhaps it could be a bit simpler: late(expr) where every operation in
expr is late bound if possible. That way it is very clear what will be
late bound and what will not. Also late(...) will always "return" object
so where casting is needed will be clear. We could even make it illegal
to put an expression in late(...) that cannot be completely late bound.
That way everything in the late(...) is late bound and everything
outside it not. 

I think this would be relatively simple to implement as all we would
need to do is write a simple macro with no syntax and if non-late
bindable expressions are illegal there would also be no need to handle
passing those expressions through.

macro late(expr)
{
	late_bind_all_expressions( expr );
}

I am generally against operator precedence tricks because it tends to be
confusing. And in a case like this there is no standard to go by like
there is for math operators, so any person reading the code who had
never used the late macro could have a lot of trouble understanding
exactly what is happening. 


I just realized that what I am talking about is probably already covered
by the late { ... } syntax. And because everything is an expression in
Nemerle you could write: def i = late{ o.Member() } :> int + 1

However I thought since I had already written all this I may as well
post my thoughts to add to the idea pool.

-Arthur






More information about the devel-en mailing list