Skip to content

v0.29.0

Compare
Choose a tag to compare
@emil14 emil14 released this 20 Dec 17:28
· 25 commits to main since this release
454720e

Nevalang is a general purpose dataflow programming language with implicit parallelism and static typing that compiles to Go and machine code:

What's New?

This is another big release. This time we ship 2 big things and a lot of small ones. Number one big thing is support for anonymous ports in interfaces and another is solving DI drilling problem

Interfaces With Anonymous Ports

// before
interface IDoer(data any) (sig any)

// after
interface IDoer(any) (any)

This allows to have interfaces with many more implementations and makes implementing an interface much simpler. All this leads to much better composability in the ecosystem.

This is however only supported for nodes with 1 inport and 1 outport.

DI Drilling

The name is similar to React's "props drilling" problem

import { fmt } // package with dependency (with interface implementation)

def Main(start any) (stop any) {
    foo Foo{printer fmt.Println<any>} // dependency injected
    ---
    :start -> foo -> :stop
}

interface IPrinter(any) (any) // anonymous ports, baby

def Foo(start any) (stop any) {
    bar Bar{printer IPrinter} // dependency passed through
    ---
    :start -> bar -> :stop
}

def Bar(start any) (stop any) {
    printer IPrinter // dependency defined
    ---
    :start -> printer -> :stop
}

Nevalang supports dependency injection natively almost from the beginning. However, it was very limited up to this point. It was impossible to have intermediate layer between dependency provider and dependency consumer.

For example, Filter uses Split inside. Split needs dependency IPredicate (which is now any component that receives T and sends bool implements, thanks to anonymous ports interfaces feature!). And now you as a user can pass dependency to Filter, so Filter can bypass it right into split.

This was fundamental limitation for several years of development and solving it was a bit step for the language.

WARNING: You have to explicitly reference name of the dependency at each layer (in this case "printer") because otherwise compiler won't figure out where defined dependency comes from. This might be and might not be a temporary limitation, but that's the way it is.

Nevalang supports anonymous dependency injection similar to how it supports anonymous ports for interfaces (oh yeah) now, so if you don't have DI drilling in your case (Dependency flow is 1 level from parent to direct child), then feel free to pass deps Node{Dep}. Remember it's only possible when there's 1 dependency so compiler don't have to guess

Everything Else

  • Refactoring (stdlib) - renaming of ports of components for consistency
  • Refactor (compiler) - irgen package doesn't use compiler.Error because any error at that step is internal
  • Bug fix (compiler) automatically trims trailing / with neva run and neva build
  • Bug fix (lsp) - language server doesn't lookup neva modules upper than current workspace
  • Improvement (compiler) - parser saves location of each entity for better compiler errors
  • Bug fix (stdlib) - Filter component is re-implemented and is available to use again and all its e2e tests are active. New implementation handles .idx field of a stream<T> message properly (this caused a deadlock in specific programs)
  • ... and more!

This release closes following issues