This page is not available in requested lang, reverting to default lang
Nosica is born for mainly 2 reasons :
- Java is a good example of how simple a syntax can be (compared to c++ for example)
- Java lacks some ability of C++ (and some other languages)
When designing the language, we tried to follow some guidelines :
- Keep the syntax simple and coherent
- Introduce some features we think are missing (like genericity)
- Add new mechanism to get rid of nasty casts
- Keep the number of First Class Object to the minimum
Why is that ?
- a simple syntax makes a program easier to read, thus is easier to maintain
- it lacks some construct to allow the reusability of some design patterns (like typed containers, Factory, ...)
- dynamic cast, instance of contruct are Ok but they can be automated and in certain case enforced at compil time.
- We only have 3 First Class Object(FCO) : Object, None and Array. All other types (even the native one) can be defined in user land. This allows us to extend when needed the interface of those types very easily as we don't impact the compiler.
Consequences :
- In order to have a simple syntax, we started the grammar from the java grammar.
- To allow the reuse of some design pattern, we introduced genericity. Genericity allows one to implements and reuse Guard, Factory, or Singleton for example.
- To get rid of most of the cast, we introduced covariance everywhere. A language like C++ is covariant on the result type for example, but mostly invariant. Nosica is invariant at first and covariant on the result type too. This ensures all interfaces are properly implemented. Once an interface is propertly implemented one can add new covariant methods to refine further the interface. One side effect is that it simplifies greatly some pattern using double dispatch like the visitor pattern.
- Trying to have as few FCO as needed impact greatly the language (in the right way we think). That means we have to bring the needed tools to build native types entirely out of the compiler. So we needed to define value types (aka primitive types) like int, double in Java. Thus we introduced the primitive/reference types. We needed to allow a type to overload an operator, because we need to write int i = 2 + 3; We needed to define an array operator so we introduced array properties. We needed to define the length property like in Java, so we introduced the properties as well.
From time to time we thought of new features that would help coding in Nosica.
- As in Java, Nosica supports only single inheritance (and multiple interface). But sometimes we end up really doing like multiple inheritance by 1-inheriting from interfaces, and 2-delagating methods of those interfaces to other instance. To automate this task, we introduced the 'proxies' notation.
- Sometimes we really need to return multiple values. Defining a signature with input/output values are quite bad when you only want output parameters, because the proper use of the method cannot be enforced by the compiler : so we introduced multiple return value. Another side effect is that it reduces the number of keywords and this is often the indication of a good feature because it generalizes a concept.
- We added Signal/slot because it decouples greatly the code, is reusable, has a simple syntax and is really (I mean *really*) powerfull.
No comments yet