> I mean .... yes, that's kinda what you get if you don't do weird 
> sub-partitioning and separate compilation

Separate compilation is a form of abstraction (at least), because when the app 
gets linked against the library/dll, types are gone and an ABI only remains.

Your example defines (implictly) a supertype that defines a field a : int , and 
a derived type Notvisible that is not known at main.nim. However, the supertype 
is known at main.nim, because it has access to the field a : int .

> Nim's modules could be more sophisticated, but they work, and are simple and 
> intuitive

Interesting. I'd say that Nim creates dependencies between types that can't be 
seen easily. Notvisible and its field `a : int` do have the "*" export 
qualifier both. But they are used differently and there is an abstraction 
barrier between them.

> Nim's generics are basically identical to C++'s templates

Every language that allows for types in macro-expandable code allows to hide 
these parameters behind a common superclass (or function) where the 
instantiated param. type doesn't occur. In C++ it is done with virtual base 
class functions and the derived class functions are implemented with an 
instantiated generic component. You will find the same design pattern in Java, 
C#, Rust, Swift, Kotlin, etc etc. And now Golang is just on the corner to do 
the same.

But not Nim.

> Nim's concepts are likewise almost identical to C++'s concepts

What effect do have concepts in Nim? In C++, templates can have effects (they 
are turing complete) and therefore, concepts will have effects too because they 
impose restrictions on templates.

In Nim : What does a construct `= concept t, type T` really mean? (the T part) 
Is it possible to bind an intrinsic type (existential type) to T ? I tried 
several things but I couldn't succeed.

We don't have vtables in Nim and therefore, if we want abstraction, we have to 
resort to module abstraction. If not, we have to deal with a declared type 
system and an (undeclared) implicit type system as it is the case just now. For 
a small project, it doesn't play a role, it simply works - obviously. But I 
doubt that this will hold for projects on a larger scale. 

Reply via email to