@property usage

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 8 23:58:12 PST 2014


On 12/9/2014 4:31 PM, Nicholas Londey wrote:

> Does @property ever make sense for a free floating function? I would
> have thought no but was recently asked to add it if using the function
> with uniform call syntax.

I use it from time-to-time. I assume you think of properties as 
belonging to objects and not just something that is useful with UFCS. 
Keep in mind that free-floating functions belong to modules and modules 
(usually) belong to packages. These are units of encapsulation above 
classes & structs. There could be (and has been in these forums) lengthy 
debate about what constitutes a property and what doesn't, but whether 
or not a function belongs to a class or struct shouldn't enter into it, IMO.



More information about the Digitalmars-d-learn mailing list