Question to seek clarification on the definition of "..." in type signatures
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 25/100
Direção de pesquisa
Comece lendo o pull request #2540 e a issue #1293; em seguida, compare a discussão deles com as assinaturas Example1 e Example2 nesta issue. Considera-se concluído quando houver uma resolução explícita sobre se ... denota assinaturas herdadas, sobrecargas ou ambos, e sobre se o comportamento ou sua documentação precisam de esclarecimento.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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 :)
- Linguagem predominante
- Ruby
- Estrelas
- 2.2k
- Forks
- 263
- Merge médio
- 1d 20h
- PRs com merge (30d)
- 64
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de ruby/rbs
-
InlineParser: `@rbs @ivar` annotation is reported as unused unless it is the first thing in the class bodyTalvez já em andamento @ksss assumiu há 50 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
Mantenedores costumam responder em até 1 dia
Issues semelhantes
-
Update axe-core to v4.14.1Talvez já em andamento @axe-core assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
dequelabs/axe-core-gems#539 ·
-
Pro request form loses all text when the subject is too longTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertabug f:request-creation professional
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
mysociety/alaveteli#9733 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
needs verification
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
Mantenedores costumam responder em até 13 dias
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
betagouv/conseillers-entreprises#4808 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100