# File lib/trollop.rb, line 666
  def self.create(name, desc="", opts={}, settings={})

    opttype = Trollop::Parser.registry_getopttype(opts[:type])
    opttype_from_default = get_klass_from_default(opts, opttype)

    raise ArgumentError, ":type specification and default type don't match (default type is #{opttype_from_default.class})" if opttype && opttype_from_default && (opttype.class != opttype_from_default.class)

    opt_inst = (opttype || opttype_from_default || Trollop::BooleanOption.new)

    ## fill in :long
    opt_inst.long = handle_long_opt(opts[:long], name)

    ## fill in :short
    opt_inst.short = handle_short_opt(opts[:short])
    
    ## fill in :multi
    multi_given = opts[:multi] || false
    opt_inst.multi_given = multi_given

    ## fill in :default for flags
    defvalue = opts[:default] || opt_inst.default 

    ## autobox :default for :multi (multi-occurrence) arguments
    defvalue = [defvalue] if defvalue && multi_given && !defvalue.kind_of?(Array)
    opt_inst.default = defvalue
    opt_inst.name = name
    opt_inst.opts = opts
    opt_inst
  end