@property on free function for UFCS?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 14 08:50:52 PDT 2015


On Sun, 14 Jun 2015 12:26:52 +0000, rcorre wrote:

> Suppose I have a function defined like so:
> 
> void foo(int i) { }
> 
> intended to be called like:
> 
> 5.foo
> 
> Should it be labeled with @property?
> Or is @property only for true member functions?

only if you plan to use it like `foo = 5;`. i.e. exactly like field/
variable. compiler will not complain, but putting `@property` here is 
stylistically wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150614/b4e8ed2e/attachment.sig>


More information about the Digitalmars-d-learn mailing list