Live data from Hacker News

Beads: Computer language and toolchain

beadslang.org

131–140 of 235 posts

Re: Beads: Computer language and toolchain

#131

"Some people, when confronted with a problem, think 'I know, I'll u̵s̵e̵ ̵r̵e̵g̵u̵l̵a̵r̵ ̵e̵x̵p̵r̵e̵s̵s̵i̵o̵n̵s̵ invent a new programming language that will unify everything.' Now they have two problems."

Funny you should mention Regular Expressions. In Beads there is a complete rewrite of the syntax for regular expressions, replacing the meta characters with a more readable vertical format that facilitates comments, and offers subroutines. For example, compare the IPv4 address regular expression as done in JS: ``` (\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]){3}| ``` with the Beads notation…

I've got to be honest I can read the regex example even without the comments you added in your example, I can't read the example.

"Group or digit" matches 0-9?

I dont think it helps that you're missing newlines. Try putting four spaces at the start of every line.

Re: Beads: Computer language and toolchain

#132
post #48

- promises far fewer bugs - promises to replace entire stack - ...and Excel - "declarative languages have almost no bugs" - built-in database Yeah color me skeptical. I love experiments, but I prefer those that under-promise and over-deliver. People have been promising unification languages since there were only two languages. People have been promising cross-platform since there were two platforms. And people have b…

The thing that really bothered me was the FizzBuzz example [0]. The core logic is: cell // this routine will be called 100 times, and the implied block variable // b will hold values, like the sequence number b.cell_seq var ss : str case mod(b.cell_seq, 15) | 0 ss = "FizzBuzz" draw_rect(fill:LIGHT_SKY_BLUE) | 3, 6, 9, 12 ss = "Fizz" draw_rect(fill:LIGHT_GREEN) | 5, 10 ss = "Buzz" draw_rect(fill:YELLOW) else ss = to_s…

> is to ensure the programmer does not try to write this exact code

I agree with your thoughts around the language constraints, but I see more room for what you once could have gotten from using FizzBuzz as a minimum-skill filter. It depends on the level you're hiring at.

From a novice engineer I would be content if they're demonstrating awareness that multiples of 15 represent an edge case without it being included in the instructions.

If I'm hiring someone more senior, I'd expect them to provide (or iterate to) a more optimized solution to FizzBuzz.

But in a further tangent - I think this using this type of question as a minimum-talent filter stopped becoming viable as soon as it became commonly used. In the time since, it's become more a minimum-knowledge filter -- and that doesn't tell you anything about the candidate's methods in solving a problem with derivable requirements.

Re: Beads: Computer language and toolchain

#134

Earlier quoted context omitted.

Where do I need to look for declarative examples? This: https://github.com/magicmouse/beads-examples/blob/master/Exa... looks like good old imperative Basic.

There are more examples in the SDK, and the larger projects which have complex drawing going on, show the declarative layout system to its full advantage. Probably the best liked feature of Beads is invisible in the syntax, as it follows the State-Action-Model pattern (see sam.js.org), and when a state variable changes, any layout that used that variable is automatically regenerated. This is of immense value when you…

So it's Basic for 99% of the overall programming, with something like CSS or Android's layout engine thrown in to solve the remaining 1%, specifically laying things out on a screen? Maybe you forgot to link to a convincing example.

Re: Beads: Computer language and toolchain

#135
post #48

- promises far fewer bugs - promises to replace entire stack - ...and Excel - "declarative languages have almost no bugs" - built-in database Yeah color me skeptical. I love experiments, but I prefer those that under-promise and over-deliver. People have been promising unification languages since there were only two languages. People have been promising cross-platform since there were two platforms. And people have b…

The thing that really bothered me was the FizzBuzz example [0]. The core logic is: cell // this routine will be called 100 times, and the implied block variable // b will hold values, like the sequence number b.cell_seq var ss : str case mod(b.cell_seq, 15) | 0 ss = "FizzBuzz" draw_rect(fill:LIGHT_SKY_BLUE) | 3, 6, 9, 12 ss = "Fizz" draw_rect(fill:LIGHT_GREEN) | 5, 10 ss = "Buzz" draw_rect(fill:YELLOW) else ss = to_s…

Depends on your definition of 'simple', I guess.

My preference is to have all behaviours be explicit in the declared code, rather than implicit or as a side-effect. Much simpler to read and reason about the program.

Clarity over cleverness. To that end, I prefer this version over 'hiding' the mod 15 case for the sake of saving a line of code.

I also appreciate languages that warn (or better, require) that all cases are covered.

Re: Beads: Computer language and toolchain

#136
post #63

Earlier quoted context omitted.

Given the implementation is `cookie_write(KEY, my_state, duration:1 day)` I am fairly sure even this example has a bug.

I am not aware of any bug in this code. It works, and the selection persists. Of course it is a silly project. Classic FizzBuzz is just too simple a task to show off any language features, so the task was souped up so that it draws a 10x10 grid of the results, and lets you pick one of the 100 cells to highlight. It persists this selection for a day to show how one can save up to 1kb of state information trivially ins…

OP means that the comment says it's persisted for a month, but the actual code persists for a day.

Re: Beads: Computer language and toolchain

#137

I would seriously consider toning down the marketing speak. This project is making very bold claims, without citations, while trying to appeal to an often skeptical crowd (developers). "Graph databases are considered more powerful and modern than relational databases," ... okay? According to what benchmark and for what workloads? A statement like that is an immediate turnoff because it is dismissive of 30 years of da…

> I don't see how "special rules of arithmetic and a robust mathematical model" makes it "extremely difficult to have a serious malfunction."

The only way would be to have arbitrary precision integers by default and thus no overflows ever. (IIRC smalltalk was something like that, but it was long time ago since I used it, so I'm not sure)

Re: Beads: Computer language and toolchain

#138
post #48

- promises far fewer bugs - promises to replace entire stack - ...and Excel - "declarative languages have almost no bugs" - built-in database Yeah color me skeptical. I love experiments, but I prefer those that under-promise and over-deliver. People have been promising unification languages since there were only two languages. People have been promising cross-platform since there were two platforms. And people have b…

> declarative languages have almost no bugs

That one piqued my attention. It's one thing to say "fewer bugs" and quite another to say "almost none". Rust is a declarative language with one of the more rigorous static analysis checkers (for pedants: among mainstream languages) and I still write buggy code.

Re: Beads: Computer language and toolchain

#139

Earlier quoted context omitted.

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).

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 unive…

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

#140
post #5

Is the beadslang website made in beads?

There's an example Beads web site here: https://github.com/magicmouse/beads-examples/tree/master/Exa... The index.beads and (I think!) corresponding index.html files are... quite something. I'm not 100% sure this will catch on.

Note that unless I'm very confused, the index.html is the transpiler output rather than human written.

The calculator example here makes rather more sense to me: https://github.com/magicmouse/beads-examples/blob/master/Exa...

Post reply on HN