[Issue 10258] Add hasAccess trait

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 19 11:39:00 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10258



--- Comment #6 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-07-19 11:38:58 PDT ---
If what you really need to check is whether code has access to a particular
symbol (as opposed to whether using it works), then it would be much more
idiomatic if there were a trait for it rather than combining __traits(compiles,
...) with __traits(getMember, ...). So, from the standpoint of code clarity, a
trait would be preferable. However, in most cases, I would think that it would
be better to check whether using a symbol works rather than checking whether
it's accessible, since that's generally what you care about. But if we have a
strong enough use case for checking explicitly for access, then I think that it
would be better to have trait for it because of what it gives you in code
clarity.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list