Properties
"Jérôme M. Berger"
jeberger at free.fr
Sun Jan 11 11:07:35 PST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andrei Alexandrescu wrote:
> Miles wrote:
>> Daniel Keep wrote:
>>> Yes, property syntax can simplify some cases, but this isn't one of
>>> them.
>>
>> One good distinction properties and normal functions ought to make is
>> that functions should never be called without (), and properties should
>> never have () unless it has a function type.
>>
>> Current syntax allows crazy things like:
>>
>> ----------
>> exit = 1; // it is not an assignment
>> x = toString = getenv = "PATH"; // creepy, but valid D
>>
>> if (fork == 1) // not comparing the value of a variable
>> ----------
>
> Walter and I see eye to eye that a possible solution would be to only
> allow the a = b syntax as an alternative for a(b) only if there's also a
> function a(). All of the above can be fixed within that framework.
>
Won't work: how do you then create a write-only property?
Jerome
- --
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAklqQ3cACgkQd0kWM4JG3k8TCACdG8B16tlHlJJuv5ct7gegvog3
HuAAmwb/ooNnVrtpkLIh7u/I3uUwpqXK
=+nhK
-----END PGP SIGNATURE-----
More information about the Digitalmars-d
mailing list