Question to seek clarification on the definition of "..." in type signatures
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reading pull request #2540 and issue #1293, then compare their discussion with the Example1 and Example2 signatures in this issue. Done means reaching an explicit resolution of whether ... denotes inherited signatures, overloads, or both, and whether the behavior or its documentation needs clarification.
Written by the indexing model from the issue text.
Description
Hi! I have a question regarding ..., specifically relating to https://github.com/ruby/rbs/pull/2540 / https://github.com/ruby/rbs/issues/1293
Prior to seeing this, I thought that:
...is used to denote overloaded method type signatures in the same class/module- Overriding a type signature from a class or module overwrites the parent signature, and it is no longer possible to reference it
After seeing this, I realise I possibly didn't understand ..., as it looks to me that:
...is also used to denote "defer to the parent type signature", similar to thesuperkeyword in Ruby...only denotessuperif there are no real method overloads
Take the following examples:
module Foo
def call: -> Integer
end
class Example1
include Foo
def call: -> Float | ...
end
class Example2
include Foo
def call: -> Float | ...
end
class Example2 # Overload/re-open
def call: -> Symbol
end
It looks to me (by RBS and Steep) that:
- Example1 uses
...to denote "super", and has type-> Integer | -> Float - Example2 uses
...to denote "overload", and has type-> Float | -> Symbol
I think that it would be great to hear what the intention of ... is, but I'll also just mention a couple of my thoughts on it:
- It feels problematic to me that a library may wish to use
...to denotesuper, but then thesuperfunctionality can be overridden if a user of the library adds an actual overload of the method signature. - Re-using
...to denotesupercould lead to confusion when reading type signatures - it is no longer clear whether this means the type signature is overloaded, or whether it is referring tosuper, especially if you have to know/understand if there are any re-openings of the class/module. - I think having a separate syntax for
supermay be better here for behaviour and readability
Thanks :)
- Dominant language
- Ruby
- Stars
- 2.2k
- Forks
- 263
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 64
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/rbs
-
InlineParser: `@rbs @ivar` annotation is reported as unused unless it is the first thing in the class bodyPossibly taken @ksss claimed this 50 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
Maintainers usually reply within 1 day
Similar issues
-
needs verification
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 13 days
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
betagouv/conseillers-entreprises#4808 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
yosiat/panko_serializer#250 ·