Flag proposal

Jonathan M Davis jmdavisProg at gmx.com
Sat Jun 11 14:42:19 PDT 2011


On 2011-06-11 14:32, David Nadlinger 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 }
> ---

It's a fair bit only insomuch as the same code is duplicated in several 
places. The code itself in each instance is small. But if you do that enough 
times, it adds up. Whether it's enough to matter is debatable, but there is 
definitely boilerplate code there which could be reduced.

- Jonathan M Davis


More information about the Digitalmars-d mailing list