We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init
@msoucy
in C++ we can write:
message MyMessage{ optional Foo foo=1; } message Foo{ optional Bar bar=1; } message Bar{ optional string baz=1; }
MyMessage a; a.mutable_foo()->mutable_bar()->set_baz("hello");
in dproto we need to call init on the intermediate fields foo, bar
foo, bar
auto initialize_nullable(T:Nullable!U, U)(ref T a){ a=U.init; } MyMessage a; a.foo.initialize_nullable; a.foo.bar.initialize_nullable; a.foo.bar.baz="hello";
Would be nice to not have to call init and allow this:
MyMessage a; a.foo.bar.baz="hello";
I believe this could be implemented via a modification of Nullable that would call init on 1st access to a setter or getter.
any thoughts on this?
EDIT: asking http://forum.dlang.org/post/mailman.3422.1497731034.31550.digitalmars-d@puremagic.com for [Nullable with auto-allocation on access]
The text was updated successfully, but these errors were encountered:
The idea seems pretty good.
Sorry, something went wrong.
No branches or pull requests
@msoucy
in C++ we can write:
in dproto we need to call
init
on the intermediate fieldsfoo, bar
Would be nice to not have to call
init
and allow this:I believe this could be implemented via a modification of Nullable that would call init on 1st access to a setter or getter.
any thoughts on this?
EDIT: asking http://forum.dlang.org/post/mailman.3422.1497731034.31550.digitalmars-d@puremagic.com for [Nullable with auto-allocation on access]
The text was updated successfully, but these errors were encountered: