Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#3 F# Friendly Enumerations

closed
nobody
5
2010-01-31
2010-01-10
Keldor
No

Could you add a default enumeration to each of the various enumerations in Cloo? That is, an enumeration for the case when no flags are being passed - i.e. for the value 0. This would make it a lot easier to use in F#, which requires explicit enums for each value, or else a long, ugly type cast.

e.g. change

public enum CommandQueueFlags : long
{
QueueOutOfOrderExecModeEnable = ((int)(1 << 0)),
QueueProfilingEnable = ((int)(1 << 1)),
}

to

public enum CommandQueueFlags : long
{
QueueNoFlags = 0,
QueueOutOfOrderExecModeEnable = ((int)(1 << 0)),
QueueProfilingEnable = ((int)(1 << 1)),
}

Which lets me change

Microsoft.FSharp.Core.LanguagePrimitives.EnumOfValue<int64,OpenTK.Compute.CL10.CommandQueueFlags>(0L)

to

OpenTK.Compute.CL10.CommandQueueFlags.QueueNoFlags

Discussion

  • nythrix
    nythrix
    2010-01-10

    This will be implemented into the next version which features a new hand-written layer of enums. The old one made use of autogenerated constructs and those didn't permit such modifications easily.

     
  • nythrix
    nythrix
    2010-01-10

    • status: open --> pending
     
  • nythrix
    nythrix
    2010-01-10

    Ok. I've added None to queue flags. You can find it in /Cloo/Source/Enums.cs.

    I also checked the rest of the enums but it doesn't make sense for them to have such a flag. For example, you have to specify read and/or write access for a buffer. Passing none in this case would be an error.

    If you can think of more enums where such a value would be useful, let me know.

     
  • nythrix
    nythrix
    2010-01-10

    • status: pending --> closed
     
  • Keldor
    Keldor
    2010-01-15

    Awesome! I'll check out the latest snapshot and see how they work. :-)

     
  • Keldor
    Keldor
    2010-01-15

    • status: closed --> open
     
  • nythrix
    nythrix
    2010-01-31

    • status: open --> closed
     
  • nythrix
    nythrix
    2010-01-31

    Implemented in 0.6.0.