self-type
What is more Scala idiomatic: trait TraitA extends TraitB or trait TraitA { self: TraitB => }
Apart from the inheritance aspect, is there a di开发者_如何学Cfference between the following class templates:[详细]
2023-03-31 17:01 分类:问答Why aren't self-types looked up when calling a method on a constrained trait?
Assuming trait A { def t : Int } trait B { this: A => } why is it that the compiler doesn\'t \"know\" that I can call t on B?[详细]
2023-02-19 07:15 分类:问答scala self-type: member of type parameter error
This is a followup to this question. Why does this code not compile, and how do I fix it? trait Vec[V] { self:V =>[详细]
2023-02-06 19:50 分类:问答scala self-type: value is not a member error
This is a followup to this question. I\'m trying to implement vectors in scala with a generic super class using self-types:[详细]
2023-02-06 13:26 分类:问答Named Scala self-type still shadows "this"?
Working through these posts had me thinking I understood self-types, at least somewhat. So I created an example which failed as expected:[详细]
2023-02-06 04:01 分类:问答How to use Scala's this typing, abstract types, etc. to implement a Self type?
I couldn\'t find the answer to this in any other question. Suppose that I have an abstract superclass Abstract0 with two subclasses, Concrete1 and Concrete1. I want to be able to define in Abstract0 s[详细]
2023-01-27 08:57 分类:问答Self type inheritance in scala
Say I have the following traits: trait A trait B { this开发者_C百科: A => } trait C extends B // { this: A => }[详细]
2023-01-10 06:08 分类:问答Difference between trait inheritance and self type annotation
In Scala, I\'ve seen the const开发者_JAVA技巧ructs trait T extends S and trait T { this: S => used to achieve similar things (namely that the abstract methods in S must be defined before an[详细]
2022-12-19 08:15 分类:问答