property syntax strawman

Robert Jacques sandford at jhu.edu
Mon Aug 3 07:09:28 PDT 2009


On Mon, 03 Aug 2009 04:13:24 -0400, KennyTM~ <kennytm at gmail.com> wrote:

> Michiel Helvensteijn wrote:
>> Andrei Alexandrescu 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
>
> @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. (However,
> this may make
>
> chomped = "abcd"
>
> valid, which is not what we want.)

Why does ' chomped = "abcd" ' matter? It's a completely non-sensible  
statement that does absolutely nothing.



More information about the Digitalmars-d mailing list