Property discussion wrap-up

Timon Gehr timon.gehr at gmx.ch
Wed Jan 30 14:41:22 PST 2013


On 01/30/2013 11:30 PM, TommiT wrote:
> On Wednesday, 30 January 2013 at 21:58:53 UTC, Zach the Mystic wrote:
>> Also, because the "namespace_thingy"s have so much in common with
>> structs, I think it would be misleading to call them something else.
>
> The problem of using empty struct variables is that they take up memory.
> They have to, because you can make a pointer to a variable and then you
> can dereference that variable. There has to be at least a byte of memory
> to dereference.
>

No, that is not why. The only conceivable reason empty structs take up 
space is so that different instances have different addresses.

> So, really, the only zero-overhead way to do this is to introduce a new
> keyword that creates something that you can't take the address of,
> because it kind of doesn't exist (like a namespace). It exists only in
> the sense that it can be used to tell the compiler which operators and
> functions to call. That's what my namespace_thingy is.



More information about the Digitalmars-d mailing list