[Issue 20316] array properties fail hasMember

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 30 09:54:20 UTC 2019


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

--- Comment #4 from RazvanN <razvan.nitu1305 at gmail.com> ---
As for capacity, it is not listed on the list of properties for arrays and it
is implemented as a druntime function. I guess this bug report opens the
philosophical question of what hasMember actually means. For example, sizeof is
not actually a member of any type, it is a property that may be queried; that
property may be implemented as a function directly in the compiler or it may be
a function in druntime or it may be an actual member of the int class; this all
depends on how it was actually implemented, which is not something that the
user cares.

In my opinion, hasMember should only work on aggregates, because there we are
talking about actual scope declarations that have members. builtin types should
all return false on hasMember queries because builtin types don't have any
members, rather they have properties. If you want to see what properties a type
has you can simply use traits(compiles).

--


More information about the Digitalmars-d-bugs mailing list