v0.27.0
What's New?
After discord discussion a decision was made to increase priority for #717, this release fixes that issue.
Before you had to use deferred connections -> {}
feature (or explicit locks) almost always when you wanted to use constant references or literals as network senders. Example:
:start -> { 'Hello, World!' -> println -> :stop }
Now alternative syntax is supported:
:start -> 'Hello, World!' -> println -> :stop
It means that now constant references and literals are valid parts of the chained connections.
By the way, old variant is still supported, 1) deferred connections are needed not just to block constants 2) because constants must be used outside of chained connections (e.g. inside binary/ternary/switch/etc expressions).
From now on you should always prefer using this new syntax, instead of old one, because it's easier to read and it has better performance. However, there might be cases where ->{}
is exactly what you need.
How it Works?
Old variant
:start -> { 'Hello, World!' -> println -> :stop }
Hello World!
const was sent to println
in infinite loop from the program startup, but implicit lock
node, that was waiting for the signal from start
port, was inserted between then. Important note is constant sender was not waiting for anything and instead we had to defer receiving event, to guarantee that we will print exactly once.
New variant
:start -> 'Hello, World!' -> println -> :stop
Hello, World!
const waits for signal from start
port and then sends a message to print
.
Range expressions work in a similar way
:start -> 1.100 -> ...
Implementation Details
This works thanks to new builtin.NewV2
(name is temporary) native component that behaves almost like builtin.New
except instead just sending configuration message in infinite loop and being only by the speed of receivers, NewV2
has input port sig
- it awaits for input signal and sends a message to receivers, then blocks until new sig
message comes in, and so on and so forth.
Other
- Several minor refactorings and bug-fixes in the compiler, a few more unit-tests added
Pull Requests Included
- feat(readme): hello world, more verbose form for by newcomers by @emil14 in #764
- Update README.md by @emil14 in #765
- feat(docs): add features from v0.26 by @emil14 in #769
- feat(tutorial): basics by @emil14 in #770
- Constants as triggers by @emil14 in #772
Full Changelog: v0.26.0...v0.27.0