[Issue 8161] give an error for invalid property functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 6 19:35:16 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=8161

--- Comment #11 from bitwise <nicolas.jinchereau at gmail.com> ---
I think @property could be useful in metaprogramming as a means of saying "This
function acts like a field". Rather than going through all kinds of checks to
see if the symbol was useable as such, it would suffice to check if it's
@property, and then possibly which overloads are present to determine whether
it's read/write/both.

I think a good library implementation could do the same thing though:

enum Accessibility { Read, Write, ReadWrite }

template isUseableAsFieldOf(T, F, Accessibility access = Accessibility.Both)(F
fun) {...}

I would use something like that as a quick way to verify the target symbol of a
serialization function.

--


More information about the Digitalmars-d-bugs mailing list