Bye-bye, bool!
After the previous blog post, one of the
followers brought an interesting suggestion in our Telegram chat (join it btw).
He proposed getting rid of the object bool
and making if
an object not an atom.
And it was quite interesting. So we made a new release
where we followed our follower’s proposal.
The idea is simple: instead of one object bool
, we introduced two new objects, true
and false
,
which decorate specific bytes
, 01-
and 00-
, respectively.
[] > true
01- > @
[] > false
00- > @
Such implementation has the next benefits:
- There’s no way to create a boolean object with an unexpected amount of bytes.
- We got rid of the atom
if
and defined it right insidetrue
andfalse
:
[] > true
01- > @
[left right] > if
left > @
[] > false
00- > @
[left right] > if
right > @
The decision on which if
branch we should jump to is transferred to the moment of creation of the
objects true
or false
.
- We got rid of two literals
TRUE
andFALSE
in EO grammar. - The implementation of other
bool
objects likeand
,or
,not
became simpler.
So, the result true
and false
objects now look like:
[] > true
01- > @
false > not
[left right] > if
left > @
[x] > and
01-.eq x > @
[x] > or
^ > @
[] > false
00- > @
true > @
[left right] > if
right > @
[x] > and
^ > @
[x] > or
01-.eq x > @
That’s it for today. There are more interesting features we introduced in the last release. We’re planning to write blog posts about all of them because they’re worth it. So keep following us!