On 2013-02-01 15:54:14 +0000, "Zach the Mystic"
<[email protected]> said:
And there is simply no need for a data-less struct to allow a "this"
pointer. There will never be any need to know the address of a
data-less struct. Any use of it will simply give: "Error: a struct with
no data may not contain a 'this' pointer". And any use requiring taking
its address is statically disallowed at compile time. This is not a
hard feature to implement.
I think what Steven is saying is that you're distorting the concept of
a struct beyond recognition. What you really want/need is just some
kind of namespace inside the outer scope.
Note that D almost has what you want already if you do it through a
template mixin:
http://www.digitalmars.com/d/archives/digitalmars/D/properties_using_template_mixins_and_alias_this_87952.html
The
only thing missing is opGet or an equivalent, and probably a more
straightforward syntax. And perhaps someone should check whether the
functions can be made virtual too (another requirement that doesn't
really belong in a struct).
--
Michel Fortin
[email protected]
http://michelf.ca/