In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to understand the basic types and member definitions of scala". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to understand the basic types and member definitions of scala.
The type of a class member depends on how the member is referenced. There are three main concepts:
1. The collection of basic types of type T
two。 Type T in class C visible from prefix type S
3. Member binding collection of type T
The following are detailed definitions of these three concepts
1. The basic type set of class T is defined as follows
C is the basic type of type C and its parent type T1, and it is also the combined type T1.
With... With T
The basic type of n {R}.
The basic type of the type alias is the basic type of the alias.
The basic type of abstract type is the basic type of its upper bound.
The basic type of the parameterized type C [T _ 1 ~ (...) TN] is the basic type of type C, and every class of C
Type ai is replaced by the corresponding parameter type Ti
The basic type of singleton type p.type is the basic type of type p
compound type T1 with... The basic type of with Tn {R} is the basic type of all Ti.
Reduce the merger. It means that let Φ be the set of the basic types of Ti, if Φ includes the same class.
, such as Si#C [Ti1,...,Tin] (I ∈ I), then all of these instances
Will be replaced by an instance that is consistent with other instances. If there is no such an instance, it will lead to a mistake.
Mistake. If there is such a reduced merge, then the collection produces a collection of class types, a different
Types are instances of different classes.
The basic type of type selection is as follows: if T is an abstract class or alias, then the first
Will be applied. Otherwise, T must be a (probably a parameter) defined in a class B.
Changed) class type. Then the basic type of Saut is the base of T in B seen from the prefix type S.
This type.
The basic type of existing type T forSome {Q} is all S forSome {Q} types, S is
The basic type of T
two。 Type T in class C visible from prefix type S works only under the following conditions, and prefix type S has a
Two type instances of type C are used as the basic type, that is, S "# C [T1pr. We have the following definition
if S = ε .type, then the T in C seen from S is T itself.
otherwise, if S is the existing type S "forSome {Q}, T in C will be T from S"
So from S, the C in T will be T "forSome {Q}.
otherwise, if T is the first type parameter of a class D, then
if S has a basic type D [U1Magne.Regent un], [U1Magne.Regent un] is a type parameter, then from the
T in C seen in S is Ui.
otherwise, if C is defined in class C ", then the T in C seen in S is the same as in S".
The T in "C" is the same.
otherwise, if C is not defined in another class, then T in C seen in S is T
Itself
otherwise, if T is the singleton type D.this.type of some kind of D, then
if D is a subclass of C and there is a type instance of class D in the base type of S, then from S
The T in C seen in S is S.
Types
twenty-three
otherwise, if C is defined in class C ", then you can see it in T and S" in C as seen in S
T in "C" is the same.
otherwise, if C is not defined in another class, then T in C seen in S is T
Itself
if T is another type, the mapping described above will be performed in all its type components
If T is a possible parameterized class type, the class of T is defined in a class D and S is a prefix
Type, then "see T in S" is "short for T in D in S".
3. The member binding set of type T is (1) there is a type instance of a class in the basic type of T and the definition of d "in C
Meaning or declaration (d is the result of replacing the type T in d "with the T in C seen from T), etc.
Binding (2) binding with type modification (§3.2.7), if any.
The definition of type mapping dt is the member binding of type t in S. Under the circumstances, we can say that
Scatter is defined by dt.
Thank you for your reading, the above is the content of "how to understand the basic types and member definitions of scala". After the study of this article, I believe you have a deeper understanding of how to understand the basic types and member definitions of scala. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.