Want to contribute? Fork us in GitHub!

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:

[] > 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.

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!