Flagged enums

Hi,
it seems that the following code isn’t supported:

AnchorStyles.Bottom | AnchorStyles.Left

I believe IronPython supports this (see EnumOps.cs).

Is that syntax planned ?

– Thibaut

IronRuby should support this. Enum values are ints anyway, so that
behavior shouldn’t be hard to implement.


From: [email protected]
[[email protected]] on behalf of Thibaut Barrère
[[email protected]]
Sent: Wednesday, March 25, 2009 2:39 AM
To: ironruby-core
Subject: [Ironruby-core] Flagged enums

Hi,

it seems that the following code isn’t supported:

AnchorStyles.Bottom | AnchorStyles.Left

I believe IronPython supports this (see EnumOps.cs).

Is that syntax planned ?

– Thibaut

Yes, we can do that.

thanks for the answer.

I’ll try to create some code to handle that manually until then.

cheers,

– Thibaut

Yes, we can do that.

Tomas

From: [email protected]
[mailto:[email protected]] On Behalf Of Thibaut
Barrère
Sent: Wednesday, March 25, 2009 2:39 AM
To: ironruby-core
Subject: [Ironruby-core] Flagged enums

Hi,

it seems that the following code isn’t supported:

AnchorStyles.Bottom | AnchorStyles.Left

I believe IronPython supports this (see EnumOps.cs).

Is that syntax planned ?

– Thibaut

In case it’s useful to someone else (until flagged enums combination is
supported by IronRuby), I wrote some custom code to support that.
I’m now allowing code like :anchor => [:bottom,:top] in Magic.

Relevant code is here:

Support for flagged enums, ie :anchor => [:bottom,:right] · thbar/magic@e236e6f · GitHub

cheers,

– Thibaut

Hi,

a follow-up on flagged enums:

AnchorStyles.Bottom | AnchorStyles.Left

I seem to remember a commit that mentioned it was supported, but I’m not
sure.

Currently, either “||” or “|” fail on this example (| gives method
undefined, || returns only Bottom).

Has it been implemented ? Should I file a bug for this ? (or is the
syntax
different ?)

cheers,

–Thibaut

This works now:

AnchorStyles.bottom | AnchorStyles.left
=> Bottom, Left

Jim, there should be specs for this. Where should I add them?
enum/mapping_spec.rb or somewhere else?

From: [email protected]
[mailto:[email protected]] On Behalf Of Thibaut
Barrère
Sent: Tuesday, May 26, 2009 2:38 PM
To: [email protected]
Subject: Re: [Ironruby-core] Flagged enums

Hi,

a follow-up on flagged enums:

AnchorStyles.Bottom | AnchorStyles.Left

I seem to remember a commit that mentioned it was supported, but I’m not
sure.

Currently, either “||” or “|” fail on this example (| gives method
undefined, || returns only Bottom).

Has it been implemented ? Should I file a bug for this ? (or is the
syntax different ?)

cheers,

–Thibaut

Hi,

This works now:

AnchorStyles.bottom | AnchorStyles.left

=> Bottom, Left

thanks!

– Thibaut