Flagged enums


#1

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


#2

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


From: removed_email_address@domain.invalid
[removed_email_address@domain.invalid] on behalf of Thibaut Barrère
[removed_email_address@domain.invalid]
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


#3

Yes, we can do that.

thanks for the answer.

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

cheers,

– Thibaut


#4

Yes, we can do that.

Tomas

From: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] 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


#5

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:

http://github.com/thbar/magic/commit/e236e6fa455ea783b42dd08513dea7d80b4705d5

http://github.com/thbar/magic/blob/e236e6fa455ea783b42dd08513dea7d80b4705d5/lib/magic/enum_support.rb

cheers,

– Thibaut


#6

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


#7

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: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Thibaut
Barrère
Sent: Tuesday, May 26, 2009 2:38 PM
To: removed_email_address@domain.invalid
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


#8

Hi,

This works now:

AnchorStyles.bottom | AnchorStyles.left

=> Bottom, Left

thanks!

– Thibaut