[Issue 5889] Struct literal/construction should be rvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 30 00:19:49 PDT 2011


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



--- Comment #8 from Kenji Hara <k.hara.pg at gmail.com> 2011-06-30 00:14:51 PDT ---
(In reply to comment #7)
> But that's true of immutable as well. In reality, any struct literal which
> exists at run time is stored in the executable as if it were immutable (just as
> for a string literal).

??? I'm not speaking about object const-ness.
Yes, immutable struct literal will be stored in data-segment, but that is
binary level issue, and definitely different from language semantics level.

Give you an example.
https://github.com/9rnsr/scrap/blob/master/typecons/unique.d
This is my prototype code to improve std.typecons.Unique.
In it, by receiving only rvalues for its initializing and assignment, Unique
type can keep the uniqueness of stored object.

Similar improvements will be able on Scoped!T. By receiving only rvalue for
initializing, we can separate the struct object that allocated on stack and
others not.

-- 
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