On 2009-07-27 09:40:04 -0400, Kagamin <[email protected]> said:
Michel Fortin Wrote:
I mean, what's the purpose of giving a type to the namespace when you
already have a type for the opGet return value?
It's more of property than namespace, so opGet return type can be
inferred from the property type. See the paragraph about type inference
for getter and setter.
Ah, I see. Makes sense.
But personally I think I prefer the basic namespace approach. I just
don't like functions with some magic names that have a special syntax
in some special context, even if that syntax optional. Especially since
there is some risk of incoherency; for instance should this be illegal?
int width
{
float opGet();
}
or even this?
float width
{
void opSet(int);
}
And if so, what about this:
float width
{
void opSet(int); // version with int-optimized calculations
void opSet(float);
}
With the namespace approach (renamed the keyword to "property" here)
there is no such ambiguity possible:
property width
{
float opGet();
void opSet(int); // version with int-optimized calculations
void opSet(float);
}
--
Michel Fortin
[email protected]
http://michelf.com/