Properties

Denis Koroskin 2korden at gmail.com
Sun Jan 11 11:32:20 PST 2009


On Sun, 11 Jan 2009 21:52:27 +0300, bearophile <bearophileHUGS at lycos.com> wrote:

> Nick Sabalausky:
>> Yes, but 1. As you indicated, it could only happen in D when using an
>> initializer on an "auto". And 2. I would imagine that would probably get
>> caught as soon x was used.
>
> You are right, Python being dynamically typed the situation is a little  
> worse there.
>
>
>> then using "foo" without "&" or "()" should be
>> prohibited. (In fact, maybe that would be the ideal solution?)
>
> That's what I was saying, to disallow "foo" without () or &. It's not  
> the ideal situation but to me it looks better than the current ones (of  
> both Python and D1).
>
> Bye,
> bearophile

Yes, this is the best design so far.

I'd also note that using foo without either "&" or "()" is still necessary to get access to foo's set of properties:

auto s = foo.stringof;
auto m = foo.mangleof;
// etc

Other than that I'm absolutely agree with both of you.
Too bad language designers don't participate in the discussion.



More information about the Digitalmars-d mailing list