I have noticed that Scala standard library uses two different strategies for organizing classes, traits and single objects. .
-
Using those packages whose members are imported, for example, how you get access to
scala.collection.mutable.ListBuffer This technique is familiar with Java, Python, etc.Using the members of the type of properties For example, how does this get you access to the
parser type? You first need to mix inscala.util.parsing.combinator.Parsers . This technique is not familiar with Java, Python, etc., and is not used much in third party libraries.I think that (2) has an advantage that it organizes both methods and types, but Scala 2.8 can be done by using light (1) in objects of objects is. Why are both strategies?
The note here is . This option is number 2 which you talk about, and I will only talk about it. Unless you solve the problem by this, you should always take the option number 1.
Do you miss that
Parser classparser class really,parser class depends on itself that < Code> Input is defined onparser :Abstract class parser [+ T] extended (input => parscult [t] )type
input is defined as:type input = reader [alam]and
Elem is an example, for example,RegexParsers andTokenParsers and Four. Defines the preeel as thefour , while later it defines it as thetoken . This means that theparser is different for each, more importantly, becauseParser is the subclass ofparser But you will ensure that when youRegexParsersparser totoken parser or vice versa As a matter of fact, you will not be able to passparser near another example ofRegexParsers .
Comments
Post a Comment