Uniform Function Call Syntax(UFCS) and @property

Jonathan M Davis jmdavisProg at gmx.com
Thu Mar 3 15:03:48 PST 2011


On Thursday, March 03, 2011 14:07:30 Steven Schveighoffer wrote:
> On Thu, 03 Mar 2011 16:56:45 -0500, Jonathan M Davis <jmdavisProg at gmx.com>
> 
> wrote:
> > Conceptually, a property makes no sense unless it's a property _of_
> > something.
> 
> This is your opinion, not fact.  It is a property of the program/global
> namespace/module whatever you want to call it.

Per the definition of the word property, a property must be property _of_ 
something. Anything else would violate the definition of the word (not that 
programming has ever held itself all that firmly to English definitions). You can 
certainly argue that a global property is a property of a module, at which point 
it _does_ make sense in the sense that it is then a property _of_ the module. 
However, I definitely think that that's pushing it. Modules are really only 
organizational entities, not things that you deal with directly in the code. And 
if you have a "property" of a module, then it's more like treating @property 
purely as an abstraction of a variable rather than really being a property of 
something. At that point, I'd almost argue that the annotation should have been 
@variable instead.

Regardless, I'd still argue that @property shouldn't be allowed at the module 
level as long as it's going to create ambiguities. And adding extra rules or 
syntax to make it unambiguous as Kenji is suggesting seems like overkill.

> > I'd argue that C# (which has properties) doesn't have global properties,
> > but it
> > doesn't even have global variables. It doesn't have static (class)
> > properties
> > though.
> 
> Yes it does.  I've used them quite a bit.
> 
> Quick search reveals:
> 
> http://www.yoda.arachsys.com/csharp/singleton.html

Okay, so I obviously haven't used C# enough. I stand corrected.

- Jonathan M Davis


More information about the Digitalmars-d mailing list