News for hackers. Stuff that matters.
Re:T-Ruby is Ruby with syntax for types by nitza on Saturday December 27, 2025 @03:05AM (#46400096)
Their docs say that something like:

`def greet(name: String, greeting: String = "Hello"): String`

will work for kwargs with default values — https://type-ruby.github.io/docs/getting-started/understandi...

Re:T-Ruby is Ruby with syntax for types by Lio on Saturday December 27, 2025 @06:24AM (#46401030)
I think they've missed a trick there, they could have used `|` like low-type does.

e.g.

  def greet(name: String | "Hello"): String
I know it's all subjective but I think that reads better and it's valid ruby.

To be honest low-type with a static analysis tool would be my favourite syntax for this.

https://github.com/low-rb/low_type

Re:T-Ruby is Ruby with syntax for types by jrochkind1 on Saturday December 27, 2025 @07:11AM (#46401289)
That example is for positional args with default values, according to the example usage: `greet("Alice")`. Can't find ruby-style keyword args example, with or without default values. maybe no kw args in t-ruby?

Or wait, found examples that claims to be keyword arguments, but you define them just the same? I'm confused. https://type-ruby.github.io/docs/learn/functions/optional-re...