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


Marco Leise <marco.le...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marco.le...@gmx.de


--- Comment #4 from Marco Leise <marco.le...@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: -------

Reply via email to