On Thu, Aug 9, 2012 at 10:25 AM, Darryl L. Pierce <[email protected]>wrote:
> On Wed, Aug 08, 2012 at 10:53:47AM -0400, Rafael Schloming wrote: > > The extra compiler checking you get with the enums is kind of nice from > an > > API perspective. What exactly is the problem with enum values in the > > contracts? > > You can't declare a check against an enum value for an API. So we can't > leverage swig's contract feature to ensure that Ruby, for example, > doesn't try to pass a different value or type for such an API. To quote > their documentation: > > "Regrettably, there is no automatic way to perform similar checks with > enums values. Maybe in a future release." > I'm not sure what that part of the docs is talking about, but I just tried doing this and it seems to work just fine even though pn_format_t is an enum: %aggregate_check(pn_format_t, check_format, PN_DATA, PN_TEXT, PN_AMQP, PN_JSON); Maybe they just mean that it's not smart enough to automatically fill in all the enum values for you. --Rafael
