Re: Object or <T> parameters
Bryn Keller <[email protected]> Tue, 24 Feb 2004 22:03:14 -0800
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: >>I think it's reasonable. It might be nice to have it print name, type >>information, and so on. Even if it doesn't, I don't see what the issue >>is. If it's first class, you ought to be able to inspect it, IMHO. >> >> > >I agree, it might be a useful feature. But, is the current behavior useful? I >personally don't think it is. It seems likely that whenever we write: > x + f + y >when f is a function, we really mean: > x + f() + y. >given that toString(t) doesn't do what you describe above. > > Ah, I see. In that case, I propose that we make toString() return something useful for methods. :-) >>Did you mean "let d = newInstance(getClass(c))"? I would think it would >>create a new method. This would fail at runtime I imagine, since methods >>probably wouldn't have no-arg constructors. >> >> > >Yes, that is what I meant. What does getClass() mean for methods? > > Well, if we're going to be dealing with creating new methods and so on at runtime, I imagine that notionally getClass() would return class nice.lang.Method or something. This isn't implemented of course, but I think it's a reasonable guess to say that getClass() will have a sensible (and useful) meaning sometime in the future. Of course, that's just me, I don't speak for Daniel. >>A worthwhile goal, but I'm not convinced that benefits outweigh the costs. >> >> > >Fair enough. This is not a huge deal to me. I think it is something to consider >when implementing features based on the block call syntax(es). > > So noted. I agree it's easier than one might like to make a mistake and pass the method where you wanted the result of calling the method. This is common to most languages with first-class methods, of course. Some make you use some special character to indicate that you want the method, and not the call: \foo, :foo, or something like that. What do you think of that approach? Bryn ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click