Objects with type members: what is a Scala object vs module system? (Trying to figure out Odersky in 2014 by path-dependent types)

I am reading the basics of path-dependent types . On the first page in the right column it says:

Our motivation is twofold. First, we consider objects with type members not fully understood. It is unclear what causes the complexity, which parts of the complexity are essential for the concept or random to a language implementation or calculus that is trying to achieve something else. Secondly, we believe that objects with type members are really useful. They can encode many other, usually separated types. Most importantly, they combine concepts from a system of objects and modules , adding the concept of rating to other structural systems.

Can someone clarify / explain what the "object versus module" system means?

Or generally what does

"they (objects with type members) combine concepts from objects and modules , adding the concept of rating to other structural systems.

mean?

What are the concepts? Where from?

Nominality in object names / values? Structure in types? Or vice versa?

Where are the type members here? To a modular system? Object system? How? Why?

EDIT:

How is this union related to path dependent types? It seems to me that they allow this union (objects with type members). This is true? If so, how?

Could you give a simple example, what does this mean? (Ie path-dependent types that allow you to unify modular and object systems, and why would it be impossible to combine if we did not have path-dependent types?)

EDIT 2:

From the article:

, . , , .. , . , ; .

, ( ):

. , , / , ( ), , , .

, , , , (, / ), ( ), , .

+4
1

, , , .:) , ML, Scala, Scala . Scala , , (, ML, Rust ..) . , Scala / ( ML ).

ML ( Scala) ( Scala), Scala ( ). , / Scala, .

, Scala, , , , ( , ML), :

trait A {
  type X
  def getX: X
  def setX(x: X): Unit
}

def foo(a: A) = a.setX(a.getX)

foo Scala a.X, , , . Rust, .

Scala, Dotty, , , . , , Scala .

: , , , / Scala, :

def bar(a: A, b: A) = a.setX(b.getX)

:

error: type mismatch;
 found   : b.T
 required: a.T
  def foo(a: A, b: A) = a.setX(b.getX)
                                ^

, a.T b.T . , , :

def bar(a: A)(b: A { type X = a.X }) = a.setX(b.getX)

:

def bar[T](a: A { type X = T }, b: A { type X = T }) = a.setX(b.getX)

, , ( A[_] A[T] forSome { type T }, A , ).

+3

Source: https://habr.com/ru/post/1688689/


All Articles