On Wednesday, February 20, 2013 20:41:24 Rob T wrote: > The reality is that I often don't know if I'll be using one > syntax over the other until usage experience is gained and the > usage context determines the answer. I may even want to use both > forms depending on the use context.
I don't understand this. You make it a property function if it's intended to be used as if it were a variable. If it's not, then you don't mark is a property. Done. Where's the confusion? The very nature of the function should make it clear whether it makes any sense for it to be treated as a variable or not. And I'd argue that you're using properties incorrectly if you're trying to use something both as if it were a variable and as a function. There are occasionally grey areas (like when something generally would make sense as a variable, but sometimes requires additional arguments that change it's behavior - e.g. std.datetime.Clock.currTime or std.path.baseName), but that usually just means that it should be made into a function and be done with it, and in my experience, such occurrences are relatively rare anyway. So, I have no clue what you're up to that you're experiencing much confusion on this matter. Also, a number of people around here like to point people to C#'s guide on what constitutes a property (though I don't have the link readily available at the moment), which should make it clearer. But in general, all you should have to do is ask yourself whether it makes sense to treat the function as if it were a variable. If it does, then it makes sense for it to be a property. If it doesn't, then it doesn't make sense for it to be a property. - Jonathan M Davis
