[Issue 9636] New: null initialization for std.typecons.Nullable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 2 12:43:37 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9636

           Summary: null initialization for std.typecons.Nullable
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-03-02 12:43:34 PST ---
Currently if I want a Nullable function argument initialized to null I have to
use:

import std.typecons: Nullable;
void foo(Nullable!(immutable int[4]) items = Nullable!(immutable int[4]).init)
{}
void main() {}


Or with a global helper alias:

import std.typecons: Nullable;
alias NullableItems = Nullable!(immutable int[4]);
void foo(NullableItems items = NullableItems.init) {}
void main() {}


But maybe there is a way to modify std.typecons.Nullable so this simpler code
is accepted (or something equally simple):

import std.typecons: Nullable;
void foo(Nullable!(immutable int[4]) items = null) {}
void main() {}

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


More information about the Digitalmars-d-bugs mailing list