Using memberspaces for a property-like syntax and more

Era Scarecrow rtcvb32 at yahoo.com
Sat Feb 2 05:03:48 PST 2013


On Saturday, 2 February 2013 at 09:14:30 UTC, TommiT wrote:
> I propose we just forget about the whole concept of a property, 
> and instead add to D a new construct called 'memberspace'. 
> Memberspace subdivides the 'space' in which the member 
> functions and operators of a type live into separately named 
> 'subspaces', like namespaces do for freestanding functions and 
> classes in C++. Read more about the uses of this idea over 
> there (it's not my idea):

  First impression: I don't know why but I don't like it.

  It feels like you're doing the following:

  1) Declare a struct and immediately instantiate it with the same 
name. (Or union, or similar)
  2) Only one declaration of this struct can exist, doesn't count 
as nested struct.
  3) Disable all constructors/postblit/opAssign except as follows

  The only thing it has really done is allow you to force the use 
of parenthesis during a call (but only the get, not the set). 
You're then defining all opBinary/opAssign methods that it works 
with which seems like it will end up bloating the code 
considerably but not giving back as much as it takes to write it.


More information about the Digitalmars-d mailing list