Question to seek clarification on the definition of "..." in type signatures
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Beginne mit dem Lesen von Pull Request #2540 und Issue #1293 und vergleiche anschließend deren Diskussion mit den Signaturen Example1 und Example2 in diesem Issue. Als abgeschlossen gilt die ausdrückliche Klärung, ob ... geerbte Signaturen, Überladungen oder beides bezeichnet und ob das Verhalten oder dessen Dokumentation einer Klarstellung bedarf.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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 :)
- Vorherrschende Sprache
- Ruby
- Sterne
- 2.2k
- Forks
- 263
- Ø Merge
- 1 T. 20 Std.
- Gemergte PRs (30 T.)
- 64
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus ruby/rbs
-
InlineParser: `@rbs @ivar` annotation is reported as unused unless it is the first thing in the class bodyEvtl. vergeben @ksss hat das vor 50 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Update axe-core to v4.14.1Evtl. vergeben @axe-core hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
dequelabs/axe-core-gems#539 ·
-
Pro request form loses all text when the subject is too longEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenbug f:request-creation professional
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
mysociety/alaveteli#9733 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs verification
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 13 Tagen
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
betagouv/conseillers-entreprises#4808 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100