Feature #17848
closedinline rbs either by rdoc comments or changing syntax
Description
I like gradual typing - I like the syntax of rbs files but for coding - convenience it would be nice if we had inline syntax for types.
I know that steep allows you to define types inline but because it is valid ruby syntax - the code is not as nice as rbs
could we change method arguments syntax to allow rbs type
def initialize(from: User | Bot = User.new, string: String = "I got your message") -> void # I know this has to be fleshed out to handle all cases (positional , keyword, default but there should be some way we can do it inline)
Either that or bless (recommend) yard style annotations so it is inline and still has easy syntax
class Message
attr_reader id: String
attr_reader string: String
attr_reader from: User | Bot # |
means union types: #from
can be User
or Bot
attr_reader reply_to: Message? # ?
means optional type: #reply_to
can be nil
def initialize: (from: User | Bot, string: String) -> void
def reply: (from: User | Bot, string: String) -> Message
end