Image for post
Image for post

Nucleoid is an open source (Apache 2.0), a runtime environment that provides logical integrity in declarative programming, and at the same time, it stores declarative statements so that it doesn’t require external database, in short it can be used as database.

Data Structure

Data structures are defined in declarative syntax. Let’s say name is a variable, and by program requirements, name must be:

  • less than 10 characters
  • first character is upper case
  • contains no underscore character
> if( name.length > 10 ) {
throw "INVALID_SIZE"
}
> if( ! /[A-Z]/.test( name.charAt(0) …


Image for post
Image for post

In imperative (procedural) programming, it is common to have code files to compile and restart the programming runtime to get affected. So, in other words, adding new rules or learning new behaviors requires rewiring hard coded binaries. In addition, if it requires program to take different steps, it also has to go through the similar process with some configurations.

In declarative programming, the runtime works with declarative statements, which means statements don’t explain explicit steps, instead, it tells abstract logical intention. …


Image for post
Image for post

The short and long answer is Graph.

This article explains mechanics inside of the runtime, for basic usage:

Nucleoid is a declarative runtime, which means instead of compiling code files, it accepts ES6 codes (JavaScript) in-flight and builds graph. The purpose of doing this is making connection between statements, so that, the runtime can draw its own control flow and provide logical conclusion. Let’s start with a simple example:

> a = 1
> b = a + 2
> c = b + 3
Image for post
Image for post

Each statement of a = 1, b = a + 2 and c = b + 3 is received into system in separate times, since a is part of b‘s definition, the runtime draws dependency line between two, and when a is changed, the runtime automatically updates value of b, and rest of follows the same for c so on and so forth. …

About

Can Mingir

Contributor at Nucleoid

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store