class BinData::Choice

def selection=(sel)

pc #=> "Type2"
pc.selection = 17

pc #=> "Type1"
pc.selection = 5

pc = ProgrammaticChoice.new(:choices => choices)
choices = {5 => type1, 17 => type2}

type2 = [:string, {:value => "Type2"}]
type1 = [:string, {:value => "Type1"}]

end
attr_accessor :selection
choice :selection => :selection
class ProgrammaticChoice < BinData::Wrapper

then try something like the following.
If you really *must* be able to programmatically adjust the selection

This is deliberate to promote the declarative nature of BinData.
There is no #selection= method to complement the #selection method.
This method does not exist. This stub only exists to document why.
def selection=(sel)
  raise NoMethodError, "See rdoc BinData::Choice.selection= for details"
end