News for hackers. Stuff that matters.
Re:Beads: Computer language and toolchain by TacticalCoder on Thursday May 27, 2021 @10:53AM (#27303868)
And the example is weird: it explicitly explains you can do with fewer tests if the value is not true. Multiplication by N,U,ERR silently gives 0 as a result.

So multiplication by an ERR is not an error (from what I understand from quickly reading the ref).

Re:Beads: Computer language and toolchain by magicmouse on Thursday May 27, 2021 @02:22PM (#27306326)
The protected arithmetic rules in Beads are mostly a copy of the proven-to-be-useful protected arithmetic of Excel. Instead of using #UNDEF and #ERROR, those 2 meta values, are abbreviated U and ERR in Beads.

``` 3 * ERR yields ERR 3 * U yields U (3 times undefined yields an undefined value) ```

The mathematical truth tables are in the appendix of the reference manual.

It is quite useful in a language to have a universal bottom value (undefined) and a universal top value (error). The key point is to avoid undefined behavior

Re:Beads: Computer language and toolchain by mst on Thursday May 27, 2021 @05:18PM (#27308678)
Doesn't honestly seem that different from 'undefined' and 'NaN' in javascript and I think the fact that your 'NaN' is called 'ERR' is making people who think of errors as exceptions recoil.

(I'm not necessarily sure I like the trade-off you've chosen here, but I think the viscerally negative responses people are having are because of that, rather than thinking through the trade-off on its own merits)

Re:Beads: Computer language and toolchain by magicmouse on Friday May 28, 2021 @12:59AM (#27311888)
In practice any JS programmer will find that the use of the undefined value is very familiar. In Beads it is abbreviated to U as it is used constantly, because the default value of something in the graph data structures is U.

For symmetry reasons, the error and undefined values work across all types, which cleans up one of the messes in JS, where you have undefined, NaN, null, and goodness knows what else. That we have a uniform error value for nodes is a very minor point; it is almost impossible to generate an error value in the protected arithmetic world of Beads. Square root of -1 is one of the only ways I can think of.

There is no try/except in Beads, there are no exceptions as all functions are total, and all arithmetic closed (like Excel).