property syntax strawman
Michiel Helvensteijn
m.helvensteijn.remove at gmail.com
Mon Aug 3 01:31:55 PDT 2009
KennyTM~ wrote:
>>>> auto data = std.file.readText(filename).chomp.split;
>>>
>>> I love that too. Unfortunately, the way the water is moving, it looks
>>> like we'll lose some or all of that.
>>
>> That's not really true. Some of those no-parameter functions are just
>> meant to be read-only properties instead of functions.
>>
>> auto data = std.file.textFrom(filename).chomped.split;
>
> So to allow omission of the parenthesis of these "read-only properties"
> we do
No, it's not "allowing omission", it's "forcing omission". That's what
properties are.
> @property string chomped (string x) { ... }
>
> ? I don't think Walter's syntax is capable of introducing "properties"
> to these free methods, but the property attribute can.
I still think an identifier is either property or function, but not both.
And judging by the way the wind is blowing, attributes/annotations will not
be used for properties.
> (However, this may make
>
> chomped = "abcd"
>
> valid, which is not what we want.)
No, it wouldn't, since it'd be a read-only property. That means you can only
read, not write.
--
Michiel Helvensteijn
More information about the Digitalmars-d
mailing list