View mode: basic / threaded / horizontal-split · Log in · Help
April 21, 2005
Re: Object.opCmp - about time we came to a decision
Georg Wrede wrote:
> xs0 wrote:
> 
>>
>>>> True, yet it still only happens at run-time, and it may even be
>>>> unneeded:
>>>>
>>>> Object[] blah=someFunc(); // returns a new String[];
>>>> blah[0]=new Whatever(blah[0]);
>>>
>>>
>>>
>>> Anybody writing that piece of code is asking for First Blood. Out of 
>>> his own nose.
>>
>>
>>
>> Why exactly? The point was that
>>
>> a) the code handles any Object
>> b) Java would needlessly throw an exception here
> 
> 
> If the code handles "any Object", then why be surprised if the compiler 
> doesn't catch the situation where you suddenly don't want it to?

I don't get what you're trying to say, sorry..


xs0
April 21, 2005
Re: Object.opCmp - about time we came to a decision
xs0 wrote:
>> If the code handles "any Object", then why be surprised if the 
>> compiler doesn't catch the situation where you suddenly don't want
>> it to?
> 
> I don't get what you're trying to say, sorry..

Below is what I responded to:

> Object[] blah=someFunc(); // returns a new String[];
> blah[0]=new Whatever(blah[0]);
> 
> Although it's true - in D such an error will most probably not even
> get detected right away, which can probably cause quite a havoc, if
> you're lucky.. Again, I don't think forcing explicit casts will help;
> if a change is going to happen, it should be where the function is,
> not where the caller is (in other words, type safety should be
> enforced already when defining functions, not when calling them).

The code and the explanation looked as if having a reference to an 
instance of "Whatever" in the array was not welcome.

The text mentioned "such an error".

This gave me the impression that the coder had created an Object[] 
without intending it to accept precisely anything.
May 01, 2005
Re: Object.opCmp - about time we came to a decision
"Georg Wrede" <georg.wrede@nospam.org> wrote in message
news:4263B525.2090800@nospam.org...
> I meant get a Linux box for Walter, so he didn't have to _remember_ to
> update the newsgroups every time.

Jan and I have been talking about automating it a bit.
Next ›   Last »
5 6 7 8 9
Top | Discussion index | About this forum | D home