[Issue 6946] Compile-time flags generator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 15 06:22:28 PDT 2012


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


Marco Leise <Marco.Leise at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Marco.Leise at gmx.de


--- Comment #4 from Marco Leise <Marco.Leise at gmx.de> 2012-08-15 06:22:24 PDT ---
I think Delphi has the most convenient implementation of sets.

  type
     TWorkDay = (Monday, Tuesday, Wednesday, Thursday, Friday) ;
     TDaySet = set of TWorkDay;
  var
     days : TDaySet;
  begin
     days := [Monday, Friday];

     days := days + [Tuesday, Thursday] - [Friday];

     if Wednesday IN days then ShowMessage('I love Wednesday!') ;

It also uses the 2^n binary notation internally. Any proposed solution should
add safety as well as the basic set operators. As long as it is still easier to
write "set &= ~flag" to remove a flag from a set, it failed its mission.
It would be even better if a set type would be allowed in bindings to C code or
painlessly converted to it's integer representation with "set.val" or similar.
:)

-- 
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