On Sat, 11 Jun 2011 17:32:56 -0400, David Nadlinger <[email protected]> wrote:

On 6/11/11 11:20 PM, Jonathan M Davis wrote:
1. Programmers following this idiom (including the Phobos devs) end up
creating enums with yes and no values and are effectively identical to other enums except for their names. So, we end up with a fair bit of boilerplate
code just to pass a strict boolean value.

s/fair/tiny/, imho:

---
/// ditto.
enum SomeFlag { enable, disable }
---

A big problem with this (and enums in general), what if your flag function is defined inside a struct or class?

struct MyStruct
{
   /// This function ROCKS!
   void someKickAssFunction(MoreBitchin moreBitchin) {}
   /// ditto
   enum MoreBitchin { yes, no }
}

// the call, not so much.
s.someKickAssFunction(MyStruct.MoreBitchin.yes);

In other words, in order for your doc trick to work, member functions have to require an additional namespace to the enum.

IMO, however, we need a better way to access the enum values without specifying the entire namespace. The difficult part is to do it in a way which doesn't conflict with normal symbols.

Of course, such an improvement would pull the rug from this Flag proposal...

-Steve

Reply via email to