-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: @sig for :: #7
Comments
Thank you for your feedback! The Do you think having # @sig generic A < BasicObject
class Foo < Bar
# @sig @name: String
# @sig name: String
# @sig yields (Foo) -> void
def initialize(name) #:: void
end
# @sig (String) -> EmailResult?
def send_email(content)
end
end Hmm, not too bad. |
[Moved from Discord]
So what was your reason against I’m split with changing to |
No conclusion yet for
|
|
I decided to go with
|
Hey @soutaro,
First, thanks for your work. I’ve been following this repo from the very first day and very excited of where it goes.
I have a suggestion regarding the primitive syntax—use
# @sig
instead of#::
:The current syntax is shorter (guess, that’s the reason) but looks like something new and even foreign compared to
@x
annotations already used by existing tools (notably, YARD)It would make the syntax consistent (all annotations start with “@“)
It’s more descriptive (readable/understandable), especially to those not yet familiar with RBS syntax.
The
@sig
notation is also inspired by one of the prominent Ruby projects—Zeitwerk (example). It’s used there for information purpose only but looks very coherent with the rest of the documentation.We can probably reuse
@rbs
instead of introducing a new annotation, too:Since a signature must start with a
(
(right?), I think, we can distinguish it from other annotations.P.S. Now, looking at the example, I think that
@sig
would look better: it’s clear to even non-Ruby engineers that it’s a method signature (reminds of Erlang’s-spec
), while@rbs
is too Ruby-specific.The text was updated successfully, but these errors were encountered: