Author John Belmonte
Recipients John Belmonte
Date 2019-09-22.11:14:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I would like Flag class instances to have more set-like abilities:
  1. iteration, to walk through each set bit of the value
  2. len corresponding to #1
  3. subset operator

I may be told "implement it yourself as instance methods", or that #3 has an idiom (a & b is b).  Ideally though, every Flag user should be able to rely on these being implemented consistently.

When trying to implement #1 without devolving into bit fiddling, naturally one might try to use the class iterator.  Unfortunately the semantics of that enumeration include 0, aliases, and compound values.  I've used Flag in several situations and projects, and so far there hasn't been a case where that was the desired semantics.  Interesting though, if #1 were implemented in the standard library, then we could enumerate all bits of the Flag via iteration of `~MyFlag(0)`... though that's obscuring things behind another idiom.

Thank you for considering.
Date User Action Args
2019-09-22 11:14:02John Belmontesetrecipients: + John Belmonte
2019-09-22 11:14:02John Belmontesetmessageid: <>
2019-09-22 11:14:02John Belmontelinkissue38250 messages
2019-09-22 11:14:02John Belmontecreate