[Issue 9930] enum members should be hidden in an enum instance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 25 20:47:57 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=9930


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #10 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-11-25 20:47:54 PST ---
This is similar to being able to call a static member function via an instance
rather than the type, which is also something that I think is horrible and
ideally would go. Unfortunately, several other languages permit it, but IMHO,
it provides no value, is bug-prone, and it actually prevents us from
overloading on static-ness (i.e. A.foo() calls the static foo and a.foo() calls
the non-static foo), which is particularly problematic for opCall.

So, this (as well as being able to call static functions via instances) are the
sorts of rules that I find very counterintuitive and negative in terms  of
their effects. I don't know if we can fix them at this stage in the game
(particularly with regards to static member functions, since other languages
make the same mistake that we do in that regard), but ideally, D would be fixed
so that you can't access an enum member via an instance and so that you can't
access a static member via an instance. To allow it is just broken and
bug-prone IMHO.

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


More information about the Digitalmars-d-bugs mailing list