properties
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Jul 28 10:51:02 PDT 2009
Ary Borenszweig wrote:
> Andrei Alexandrescu wrote:
>> Steven Schveighoffer wrote:
>>> On Tue, 28 Jul 2009 11:11:09 -0400, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>> Guess what - they both behave like functions. So their properties
>>>> are an elaborate mechanism that is actually thoroughly unchecked,
>>>> thus going back to what you could do by calling functions. So why
>>>> the hell did they define the feature in the first place? Oh, for
>>>> allowing people to write a.foo() instead of a.foo. You know what,
>>>> that's a bit disappointing for an entire language feature.
>>>
>>> No, they did it to *force* you to write a.foo instead of a.foo(), to
>>> make it more defined that foo is a field-like entity.
>>
>> Which is not, because it can execute arbitrary code that is not
>> restricted in any way. How good a design is that? Back to semantics by
>> convention?
>
> Back to semantics by convention?
>
> Whenever you write *anything*, there's always semantic by convention.
>
> writefln("Foo");
>
> That writefln could just do antyhing with it's argument, maybe return it
> twice. So how do you enforce writefln to actually write something?
> Aaaah... D sucks because it can't enforce that.
I was replying to the expectation that a.foo() does an action and a.foo
allegedly does not.
Andrei
More information about the Digitalmars-d
mailing list