Ruby - Feature #21973: Smile argument

ko1 (Koichi Sasada)
2026-03-31T16:05:34Z

Implementation should be easy like that :)

def q(a:, b:1)
  p a:, b: #=> {a: 10, b: 20}
end

def smile_send mid, b, *params
  h = {}

  method(mid).parameters.each do |(type, key)|
    case type
    when :keyreq
      h[key] = b.local_variable_get(key)
    when :key
      h[key] = b.local_variable_get(key) if binding.local_variable_defined?(key)
    else
      raise
    end
  end

  send mid, *params, **h
end

a = 10
b = 20

# q( :) #=> will be compiled to
smile_send :q, binding