Re: Newbie question - Disadvantages of java

From: Thomas G. Marshall (tgm2tothe10thpower_at_hotmail.replaceTextWithNumber.com)
Date: 10/27/03


Date: Mon, 27 Oct 2003 16:54:29 GMT

xarax <xarax@email.com> coughed up the following:

> "Thomas G. Marshall"
> <tgm2tothe10thpower@hotmail.replaceTextWithNumber.com> wrote in
> message news:IAbnb.16920$1C5.5231@nwrdny02.gnilink.net...
>> Ronald Fischer <ronaldf@eml.cc> coughed up the following:
>>
>>> "Thomas G. Marshall"
>>> <tgm2tothe10thpower@hotmail.replaceTextWithNumber.com> wrote in
>>> message news:<FXhmb.196$1C5.28@nwrdny02.gnilink.net>...
>>>> Being the person that opened up this pandora's null box, I'd still
>>>> like to
>>>> know precisely /why/ null need be of type null.
>>>
>>> My personal guess: This is because perhaps the following underlying
>>> principle was
>>> implicitly assumed when designing the language:
>>>
>>> "Every expression shall of a certain type (irrespective of the
>>> context
>>> in which it is
>>> used)".
>>
>> Then what is the type of the expression "32767" ?
>>
>> short s = 32767;
>>
>> It seems according to the specification that it is indeed an int,
>> but there is a "special rule" for assignments that allow it to be
>> downwardly assignable to sorts without cast.
>>
>> Special rules abound. Making "null" a typeless literal seems really
>> far more benign a rule-break than making it a value of a special
>> type that is always assignable without cast:
>>
>> Thang thang = null;
>>
>> What's worse:
>>
>> Having a type value that is assignable to all object types
>> without cast? or
>> Having a litteral that is assignable to all object types?
>> (remember, no cast, because it has no type).
>
> The reasoning is that "null" has a built-in type that implicitly
> inherits from all reference types (the only case of multiple
> inheritance), and is thus assignable to any reference type
> and castable to any reference type.

That's NOT "REASONING". That's factual information.

My posts are discussing the /why/ and /what if/, not the /what is/.



Relevant Pages

  • Re: Newbie question - Disadvantages of java
    ... > assignable to sorts without cast. ... > Having a type value that is assignable to all object types without cast? ... inherits from all reference types (the only case of multiple ... and is thus assignable to any reference type ...
    (comp.lang.java.programmer)
  • Re: Dynamic object creation.
    ... D implements C which inherits from A, as B also inherits from A. ... instance of D, and cast it to A, I'll only have acces to A's methods, ... interface B: A{ ... I have three interfaces lets call them parent, child-A, and child-B. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Object Casting Question
    ... GetAndPopulate using the Object2 instance. ... > I have two objects and one inherits the other and adds a few more ... > to cast it to be the second object, then I would be able to add the extra ... > So I create object one, fill it using a database query from a particular ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Set form on the fly?
    ... If you need a variable of Type Form to be used in a method you can just cast a type down as long as the class you are casting ... inherits from Form or a casting operator has been overridden in either of the Types. ... MyForm form = new MyForm; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Specified cast is not valid problem...
    ... You're trying to cast an IPrinciple object as a ... Casting can be done from like types, such as Float and Double, or from ... System.Object, which it inherits. ... > Specified cast is not valid. ...
    (microsoft.public.dotnet.framework.aspnet)