Re: Re: myWishList
Rohan Hart <[email protected]> Tue, 21 Jun 2005 13:24:02 +1200
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 21 Jun 2005, Tom Kaitchuck said:
> I think that it is confusing that it is not declared in a similar syntax
> to how it was called. I would expect that if it was declared
> toInt(Object this) { ... }
> you would call it like
> toInt(something);
You can call it like that.
> Which of course would be confusing because it makes it look like it
> belongs to the current class.
Nice doesn't assume the current class for method calls so such a call
would always be prefixed by 'this.'
> What is the ()-> and ()=> supposed to convey? Is this syntax necessary?
()-> is the start of a function *type* which takes no parameters
()=> is the start of a function *creation statement* indicating that
the function to be built takes no parameters
> If anonymous functions are good for situations other that what I
> described, it might be a good idea to get some examples up on the wiki.
One that I've used is a reusable try-and-recover wrapper of the form:
T onMismatch(()->T action,
MismatchException->T recover) {
rememberState();
try {
action();
} catch (SpecialHandlingRequiredMismatchException e) {
restoreState();
doSpecialStuff(e);
recover(e);
} catch (MismatchException e) {
restoreState();
recover(e);
}
}
> Some of the concepts that Nice has that most other languages don't are
> shared by the D programming language. It might be a good idea if we used
> the same names for them. (And if it fits Nice's style, maybe share a
> similar syntax)
I assume you're referring to http://www.digitalmars.com/d/
I haven't read further but at least they share an ancestor in C
Rohan
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click