On Wed, Jun 27, 2007 at 11:36:23PM -0700, michael.a wrote:
> mark-28 wrote:
I agree with the sentiment, but not with the relevance. I don't see
how having a four field structure automatically appear as a completley
different two field structure, based only upon a match up between
field types and names seems more complicated and magical to me.
........
This would disagree with much of the modern programming world. Black box
programming implies that you do not need to know whether a field is a real
field, or whether it is derived from other fields. Syntactically, it sounds
you are asking for operator overloading on fields, which maps to properties
in some other language. This is not more "simpler", as it only conceals
that a function may be performed underneath. It may look prettier, or use
fewer symbol characters.
[/quote]
I really don't think it serves the thread to mince words over these matters.
I don't think having functional aliases for essentially the same data member
is magical thinking. And I made the case for the black box scenario, but I
think its also useful (especially for very low level objects) ...to know
when you are dealing with a black box (interfaced) or a very simple direct
object of the inlineable variety.
[quote]
Even so - I don't see why the following simplification of the example
provided would not suffice for your listed requirement:
class Rectangle {
Vector2d position;
Vector2d size;
};
... rectangle.position.x = ... ...
[/quote]
My foremost personal requirement is that no code need change outside the
object definition files. And besides it is ridiculous to jump through two
hoops, when one would suffice.
[quote]
To have these automatically be treated as compatible types seems very
wrong:
class Rectangle { int x, y, w, h; };
class Vector2d { int dx, dy; };
Imagine the fields were re-arranged:
class Rectangle { int y, x, h, w; };
class Vector2d { int dx, dy; };
Now, what should it do?
[/quote]
All non-toy compilers have means of insuring members are ordered in memory
as they are declared. I have a problem with people retreating to really pety
divisive arguments inorder to make regressive points.
[quote]
My best interpretation of this thread is that you are substituting
itnelligibility with DWIM, where DWIM for you is not the same as DWIM
for me, and I don't believe you could write out what your DWIM
expectation is in a way that would not break.
[/quote]
Have you read the thread? (not that you should -- but before making such an
assessment)
sincerely, (and cordially)
michael
--
View this message in context:
http://www.nabble.com/I%27m-sorry%2C-but-this-is-unacceptable-%28union-members-and-ctors%29-tf3930964.html#a11340286
Sent from the gcc - Dev mailing list archive at Nabble.com.