What is the Scala type-programming analogy for the `this` keyword? -
I'm trying to work in my own way to understand type-programming in Scala, and I've found that Most of us need to know about typing programming. There is an equivalent equivalent in price programming as reflected in it, however, I do not have to get it according to the For example, I can write the following to represent Boolean as values in the run time: Here my I can create similar type-level programming, but I do not understand how I can see that it does not come from the type of my type, You can always define an abstract type of your Boolean base type as follows: It should be good to go along, after which you can use the rules of Demorgon to do the following tasks Then you can run the this key word or self-type. It is expected of such things Rsha does not mean to, but I thought I'd ask.
Sealed attribute BoolVal {def not: BoolVal def or (Key: BoolVal): BoolVal def and (Key: BoolVal) = (this.not or that.not) def Imp .not (that: BoolVal) = this.not Or that} case object TrueVal extends BoolVal {do not dominate domes = FalseVal def override or (Key: BoolVal) = TrueVal} case object FalseVal extends BoolVal {Val = No TrueVal override def or o Ride (Key: BoolVal) that =}
and and
imp are able to take advantage of the fact that this is someone It does not matter if I have the right thing to define the wrong thing or the right object, my code can get the same code as
TrueVal and
FalseVal objects.
and and
IM are my base attributes To define in "seal" feature is not a type of type type: type type:
and and
Is there a way to define> my
BoolType in Implements , or should I Each is to define
wrong type Symptoms?
attribute MyBool extends BoolType {Type is
! (X & Y) == (! X ||! Y)
and status by a double negative:
! (! X ||! Y) == !! (X & amp; y) == (X & amp; nbsp;)
Comments
Post a Comment