[Issue 17269] formattedWrite of struct with Nullable value fails

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Mar 28 01:15:32 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17269

--- Comment #2 from Tomáš Chaloupka <chalucha at gmail.com> ---
It's easy to handle this with just one value to print, but when it is used in
some more complex structure for example just for the simple debugging purposes,
it becames PITA to workaround it while otherwise all fields of the structure
are printed just fine.

Nullable.get can't return null as it is meant to return the value type. For
example Nullable!int(42).get can't return null.

So in my opinion only specialized formattedWrite can be considered.

For example in C# this is not the problem:
http://www.tutorialspoint.com/csharp/csharp_nullables.htm

I think that Nullable should be as user friendly as it is possible. See for
example issue #13017 which was finally fixed recently.

--


More information about the Digitalmars-d-bugs mailing list