Re: Object or <T> parameters

Daniel Bonniot <[email protected]> Wed, 25 Feb 2004 01:37:24 +0100
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
>Why should toString() be available for functions? It is reasonable to make it do
>anything useful? If not, then I think toString() shouldn't accept functions as
>arguments.  Do any of the methods in java.lang.Object make sense for functions?
>  
>
At least equals and hashCode probably do, because you might want to 
build a set of functions (the set using those methods to make sure 
-efficiently- that you don't put twice the same function).

>Don't you think it is reasonable to believe that some methods make sense for
>instance objects but not for functional values? 
>  
>
Maybe.

>I don't know what you mean by "variance issue." 
>  
>
That subclasses need to have the same number of type parameters as their 
parents.

>Do you think it is not helpful to be able to catch mistakes like this?:
>     <T> T iterate(int times, void -> T fun) {
>         for (int i = 0; i < times; ++i) {
>            log(times + "th iteration: " + fun);
>            // oops, I meant fun()
>         }
>     }
>  
>
I do. I think that the right solution is a Showable interface for values 
that can be meaningfully printed.

>I think getting rid of "Any" and "Some" in their current usages is a good idea
>since there is already a better (IMO) syntax for expressing those things.
>  
>
What is Some?

Arjan just made 'Any' deprecated in the development version.

Daniel



-------------------------------------------------------
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