www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5416] New: null should have a type of its own

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5416

           Summary: null should have a type of its own
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simen.kjaras gmail.com



PST ---
Currently, it is impossible to special-case comparisons with null. If instead
null had its own type, one could allow direct comparisons between user-defined
types and null, instead of supporting comparison with any and all void*s.

For structs, such a comparison function could then be used for both 'foo ==
null' and 'foo is null'. For classes, neither likely makes sense.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 05 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5416


Benjamin Thaut <code benjamin-thaut.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code benjamin-thaut.de



PDT ---
Also if you pass null to a template it completely looses its implict conversion
abilites. See following example.

void foo(Object o){
}

void fooHelper(T)(T o){
  foo(o);
}

void main(string[] args){
  fooHelper(null); //can not implicitly convert void* to Object
}

This also stops std.conv.emplace to work correctly with constructors you want
to pass null to.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 07 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5416




01:12:57 PDT ---
n.g. discussion:
http://www.digitalmars.com/d/archives/digitalmars/D/Own_type_for_null_147608.html

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5416


timon.gehr gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr gmx.ch




 Also if you pass null to a template it completely looses its implict conversion
 abilites. See following example.
 
 void foo(Object o){
 }
 
 void fooHelper(T)(T o){
   foo(o);
 }
 
 void main(string[] args){
   fooHelper(null); //can not implicitly convert void* to Object
 }
 
 This also stops std.conv.emplace to work correctly with constructors you want
 to pass null to.
This is still true if 'Object' is replaced by Object[], 'null' is replaced by '[]' and 'void*' by 'void[]'. Therefore, '[]' needs an own type too. (I think it is the same issue, or should I file a separate bug for it?) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 27 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5416


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch



https://github.com/D-Programming-Language/dmd/pull/476

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5416


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



00:29:16 PST ---
https://github.com/D-Programming-Language/dmd/commit/31a3e406938cef17c8c6354ac5de70ad07707027

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 25 2011