【发布时间】:2018-03-14 21:22:49
【问题描述】:
在 Ruby 中,您可以这样做:
prc = lambda{|x, y=42, *other|}
prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]]
特别是,我对能够获取上述示例中的x 和y 参数的名称很感兴趣。
在Crystal中,我有以下情况:
def my_method(&block)
# I would like the name of the arguments of the block here
end
如何在 Crystal 中做到这一点?
【问题讨论】:
标签: crystal-lang