←back to thread

511 points mootrichard | 3 comments | | HN request time: 0.206s | source
1. Lammy ◴[] No.23990589[source]
It’s a separate RBS file for now, but if/when this gets integrated into Ruby itself how will it interact with the new Ruby 2.7/3.0 keyword argument syntax that also uses the colon? https://bugs.ruby-lang.org/issues/14183
replies(2): >>23991552 #>>23992175 #
2. rattray ◴[] No.23991552[source]
Difficult questions like that are exactly why matz refused to integrate this into .rb file syntax!
3. jrochkind1 ◴[] No.23992175[source]
note that syntax isn't actually new in ruby 2.7 or 3.0 at all. It's been around since ruby 2.0 in fact (Feb 2013). (keyword arguments had to be declared with default values until ruby 2.1, Dec 2013).

What ruby 2.7/3.0 do is rationalize some really weird counter-intuitive and ambiguous edge cases related to passing a Hash arg expecting it to be invoked as if it were keyword args. But it's a change in semantics, not syntax. The keyword argument syntax, keyword arguments with colons, in both method definitions and invocations, has been around for years, unchanged.