@property
Jesse Phillips
jessekphillips+D at gmail.com
Thu Jun 24 16:41:04 PDT 2010
Steven Schveighoffer Wrote:
> Save is not as obvious, but that's because the author decided the name
> without considering whether it should be a property. If it should be
> considered a property, it should be a noun (not a hard rule, but it makes
> more sense that way). I'd say something like 'copy' would look better as
> a property. But IMO, save provides almost no utility so that leads to it
> being hard to name. Blaming property syntax is not the way out.
Personally I think of a property as something that makes sense for you to "get" something and to "set" something. Sure you might provide only one of those options to control interaction, but I have a hard time seeing 'copy' as a property since you wouldn't want to write:
a.copy = "this is a copy of a";
Now, on the other side of things, calling functions without parenthesis. I don't have many issues with this except these points, and neither of these have been resolved with the current situation.
* Allows ambiguous-looking code:
int delegate() foo() {
return delegate int(){ return 5; };
}
// Is this an int or a delegate?
auto x = foo();
// Is this a reference to foo, or a reference to the delegate returned by foo?
auto y = &foo;
* Cannot use +=, -=, etc.
More information about the Digitalmars-d
mailing list