It's simple
Cosmos is simple to use. It's meant to allow for code as simple as x=2
or print('hello world')
.
Cosmos is a general-purpose language that focuses on high-level scripting.
Multiple styles
Cosmos takes inspiration from many languages and allows for a variety of styles which includes features from,
- Functional programming,
- Logic programming,
- Prototypal and procedural programming,
The user may adopt a functional, logic or even procedural style.
It's not an opinionated language by any means-which many languages nowadays are becoming, and instead lets the user write extremely non-restricted code. A programmer might make use of mode and type declarations. If they don't, variables are local-by-default and the type is inferred by the language.
Pure logic programming
Perhaps its most novel feature is that Cosmos is a legitimate logic programming language. It's our view of what modern day logic programming with a redone syntax would look like.
In particular, it focuses on pure logic programming. If the user makes a relation, it's pretty much guaranteed to be a pure relation (as cKanren, etc.).
If they don't, it's still a pure function or simply a procedure.
A lot of it is experimental or taken from other logic programming languages (Prolog II, III, etc).
It's not Prolog
It must be emphasized that Cosmos is not literally Prolog!
A typical Prolog implementation must follow certain conventions for backward-compatibility. However, there are certain limitations this brings. It means, for example, that they cannot have a sound 'not' operator. It's not a particularly minimalist language either.
As a new language, we're not bound by any such limitations. A lot of syntax decisions such as making use of whitespace, using modern operators and naming such as !=
, >=
and concat
are possible because of this.
You may see this for a better comparison.
Why prototypal languages
A lot of inspiration is also drawn from functional and prototypal languages.
Scripting languages, in particular ones based on prototypes, were some of the first to adopt and introduce to the mainstream declarative concepts such as first-class functions (now relations) and closures. They're very simple and the basic idea of using closures with dictionary data types is simple to use and implement.
In that sense, this is a "what if they went even further?" Part of the motivation and idea for Cosmos was starting off with a more typical scripting language and still wanting to explore concepts from different paradigms.