HNHacker News
TopNewBestAskShowJobs

magicmouse

53 karma · joined January 22, 2016

long time programmer. inventor of Beads programming language, great at making graphical interactive web apps. See more at www.beadslang.org
submissionscomments
magicmouse··on Beads: Computer language and toolchain
The layout system is declarative (with escape hatch to looping and conditionals), and so is the finite state machine syntax DSL inside, and the regular expression syntax (a novel reformulation).

But the nicest feature, invisible in the syntax because it is a property of the runtime under the hood, is that when you change your mutable state, any layout that used those variables is automatically scheduled for refresh. You thus declare what is on the screen, and how it is arrange, and the system knows what to do. In this sense it more like SQL, where you give it a goal, and don't specify the ordering of how to achieve the task.

There are also mini-solvers built into the language for the common tasks of solving for rectangles and points, which are quite handy.

Please take it for a spin, you might like it!

magicmouse··on Beads: Computer language and toolchain
okay i have rewritten parts of it. I hope you folks take it for a spin; it has a lot of nice touches in it; worked very hard on the balance between concision and readability.
magicmouse··on Beads: Computer language and toolchain
Beads is like VB6, and Oracle Delphi, an all-in-one language that shields you from the complexities of learning all these external tools and having to learn so many languages. To someone whom i guess a long-time developer, you might dismiss it as too simplistic for your purposes.

For example you can skip using Unix Bash and use Beads like Python as a scripting language. You can build a very nice client/server product like the "Robin Hoody" app, using the publish/subscribe functions built into the language without ever learning how to encode/decode a packet, as the runtime makes it easy to do this. So in that sense the language does offer a virtual transport layer.

Sure, you may need to drop down and encode/decode a websocket message buffer, but the point of Beads is to permit writing in a single language, without having to learn CSS and the whole pile of complexity that accompanies modern development. You can't make an easier stock quoting system (one of the examples), because it has been reduced to the absolute minimum number of lines.

The protected arithmetic of Excel is of proven utility, and i am merely imitating it. I replace #UNDEF with U, and #ERROR with ERR to make it less verbose, but protections abound in Beads both at compile time, and at runtime. In a graph database universe, you don't need scalars, tuples, lists, dictionaries, queues, hashmaps, etc., because a single more general data structure accomplishes that you need.

Graph databases are quite hot; Neo4J has grown leaps and bounds, and Oracle was forced to come out with one. I am sure that most existing systems continue to use older tech, because that is always how it goes in computers. People are still running COBOL in some places, because it is so damn fast and works perfectly at what it was built to do. I have no doubt that we will see existing tech which works fine continue to be used for another 50 years.

It makes sense to make an easier environment that is still capable, but much simpler to learn and use, and that is the goal of Beads.

As for the skepticism of crowds, my product is out there, and has no major bugs in it, and hopefully will find an audience that likes this approach.

magicmouse··on Beads: Computer language and toolchain
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 have 500 things on the screen, and knowing which part of the screen to rebuild on any perturbation of the state is actually a lot of work, and the source of many under/over refresh errors.

This might be called a sprinkling of PROLOG's deduction system, where logical implication is done in the runtime. I am not aware of any top 20 language with deduction. The layout system is declarative like CSS, but includes variables, looping, and IF statements to make it more flexible.

The simplification that Beads offers is really only apparent in graphical/interactive software, and client/server programs. Otherwise people will stick to Python, etc.

magicmouse··on Beads: Computer language and toolchain
There are two aspects of time travel. The fancier one is time travel debugging. To use TTD, you run a program inside another. The outer program is called the monitor, and the monitor can freeze the inner program, and rewind the time back to some point. There is an API to do this, and examples showing how you have your own debugger. When you rewind, you can truncate the history and start fresh from that point onward. This is very useful for testing.

The second aspect of time control, the more simple one, is that you can jump the clock forward, and change the scaling of time at will, so that you can write tests to see if the alarm clock would ring as expected. That feature is as simple the std library functions that control the clock value and scaling. (set_clock_scale(), and set_clock()).

The ability to speed up time by a factor of 10 or 100 is a great time saver for those programs that have key sections, and slowing down time to 1/20th the normal rate (slo-motion) is wonderful for debugging animations. Many languages can set the clock, but not many have time scaling; a nicety.

Beads has a small standard library (compared to OSX or Java), but it has the key features you really need.

magicmouse··on Beads: Computer language and toolchain
Beads was going to be recoded in Web Assembly, however, the many restrictions on I/O to the user's hard drive inside the browser make it very to build a compiler inside a browser. Hopefully in the near future Web Assembly will become a fully capable virtual machine, that will unify all the different hardware and operating systems, effectively becoming a universal virtual OS.

But any day now the dam will break, and WebAssembly will get access to I/O and the full browser API (last time i checked web assembly runs on its own compute-only thread, and is not permitted direct access)

magicmouse··on Beads: Computer language and toolchain
Rebol and is rebirth Red, is a very concise and powerful language. They are well funded, and will be a force to reckon with going forward. I would say the languages are very different in the sense that Beads is clearly aimed at graphical interactive software, with a layout/drawing/event model built into the language, while Red exists as a systems programming language, a variant customized for building crypto contracts, and then as a general purpose language.

They are so different that it is hard to compare. Red being a concatenative language has more in common with FORTH than Algol.

The closest thing to Beads is Elm, or visual javascript (was called Yazz) (https://yazz.com/visifile/index.html), which is another integrated product.

magicmouse··on Beads: Computer language and toolchain
I apologize for the bad writing. I am not a good writer at all, but my programming is quite solid, and i hope you will take it for a spin. It has many nice simplifications, from the reformed Regular Expression syntax, to the automatic dependency checking in layout and refresh (if the model changes values, any part of the visualization that is affected is automatically refreshed).
magicmouse··on Beads: Computer language and toolchain
I apologize that the intro video is so much nicer than my own homemade videos. After paying a pro do to make that first video of a series of a dozen videos explaining the theory behind it, i realized it was going to cost too much, and the money would be better spent on the product itself.

So that video is just part of 1 of 15 parts, and with some support and enthusiasm from people, we can continue the series, because it is o much nicer to watch a professional video with proper British narration. As the great George Bernard Shaw once said, "The United States and Great Britain are two countries separated by a common language."

I hope that people will overlook the homwbrew quality level of the videos, but the language for a spin, because you might like the language a lot. It has a lot of simplifications, and particularly for client/server web apps, where it is much easier to build reliable products.

magicmouse··on Beads: Computer language and toolchain
I consider the unified languages of the past to be VB6 and Borland Delphi as two successful environments that had many happy users who preferred to live inside that world and get things done without a lot of fuss. I know my friends when VB6 started to be disfavored by MS and they felt pressure to learn .NET refused to use .NET as it was just too hard compared to VB6. The reference manuals for .NET are 1000's of pages when you print them all out.

My measurement of complexity includes both the syntax of the language, and also how many library API's you have to learn.

Haxe, which has roots in an open source version of Adobe's ActionScript is an excellent product. I often consider switching to Haxe for the implementation of the transpiler as it would yield Linux support. I currently emit AS3 or JS code, but Haxe is a very strong possible direction in the future as Haxe has a lot of portability.

I don't consider C a unified language. It had no database, no drawing model, no event model, and Berkeley Sockets was a library added in to support the internet, that unfortunately did not achieve complete standardization. C is the most portable language, but it just a step above Assembler, and full of pitfalls.

Tools do wax and wane in popularity; they are all useful in certain circumstances, and the more generally useful the tool, the more it gets used. VB6 was abandoned by its owner MS, when Gates retired (Basic was his pet project, as it was the original foundation product of MS' fortune). People used it as long as they could (and some still do). VB6 didn't make the jump to the Internet, but it could have if MS hadn't tried to force everyone into .NET (which was very complex).

magicmouse··on Beads: Computer language and toolchain
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:

``` pattern octet group or digit // matches 0..9 set:'1-9' digit // matches 10 .. 99 '1' digit digit // matches 100 .. 199 '2' set:'0-4' digit // matches 200 .. 249 '25' set:'0-5' // matches 250 ..255

pattern IPv4 octet '.' octet '.' octet '.' octet ```

The Javascript version is extremely hard to read. I can't change the underlying engine that supports regular expressions as that is built in to the Browser runtime, but i can at least make notation friendlier.

Unified languages in the past like VB6 and Borland Delphi were beloved, and many people were productive in those environments, and clinged to them long after MS for example wanted to migrate people into .NET, because they were so much simpler.

The current complexity level that people have to endure is unnecessarily high. Never before in history did people write in 3 different languages in the same source code file (as they routinely do in JS + CSS + HTML), where they don't even agree on how comments are notated.

The current situation benefits the large incumbents like Google, Facebook and Amazon.

magicmouse··on Beads: Computer language and toolchain
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 inside the browser's cookie system, which is simpler to use than the IndexDB database (which is also available to use if you wish).

1Kb is enough to store a reasonable amount of data, and since Beads has a built-in graph database (not as fancy as Neo4J), you can store a subtree into the cookie with one line, and no encoding/decoding necessary, as that is performed by the runtime library for you (a nicety).

The convenience of working with a graph database internally, instead of the typical collection of data structures that one sees in older languages such as scalars, tuples, lists, dictionaries, queues, and pointers, is an advantage that only becomes apparent after some use of the language; i encourage you to take it for a spin.

magicmouse··on Beads: Computer language and toolchain
We have a Discord group, and am very eager to hear from users. https://discord.gg/pTAdsSW

User suggestions and bug reports are promptly followed up on. There are almost no known errors at this point, so it is very good shape.

You are correct that it has elements of JavaScript, but that is inevitable given that the primary output of the transpiler is JS code for use on the web, so some JS functions have to be present for that to work, and to inter-operate with JS, one has to use their string system.

The attempt to offer an integrated programming system, where we return to the simplicity of VB6, or Borland Delphi, is actually quite ambitious, as in order to offer such an integrated product one has to build in a database (graph in this case), a layout engine (novel, Renaissance proportion based layout model), a drawing system, and a way of coordinating between client/server (a novel subscription to a single source of truth system, with remote procedure calls).

The language is primarily based on Modula-2, which the author of Beads used for 20 years quite successfully in large commercial products. There is nothing from COBOL or Ada that i can think of (although Prof. Wirth did contribute to Ada I believe), not sure what the M language is. There are some elements of PROLOG built in that are not readily apparent, as the core programming pattern is State-Action-Model (see sam.js.org), and if you change a state variable, then any drawing code that used that variable is scheduled for refresh.

magicmouse··on Beads: Computer language and toolchain
There are about 3 slightly different methods for doing FizzBuzz, in any language, and this was but one of them.

You could express it also as an empty string, then concatenating as necessary: ''' // to those objecting to using a modulo-15 test, // we could have done the above code as follows: var ss = "" if mod(b.cell_seq, 3) == 0 "Fizz" &=> ss if mod(b.cell_seq, 5) == 0 "Buzz" &=> ss if ss == "" ss = to_str(b.cell_seq) '''

The problem with FizzBuzz as a programming language exploration is that it is far too short of a program to reveal the totality of a language, since it only consists of using the if/pattern match capability, modulo function, concatenating strings, and converting an integer to a string. The Stock market ticker program is a much better demo of the language, because it shows how to do client/server programming in a very easy way.

magicmouse··on Beads: Computer language and toolchain
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

magicmouse··on Beads: Computer language and toolchain
The loop syntax may appear unfamiliar, but since the core data structure of Beads is not lists, tuples, arrays, but instead a tree, there are various options that are more familiar to Lisp programmers, such as depth-first, or breadth-first tree traversal, but expressed as a loop, so you can conveniently stop it.

Most of the time one will use a loop in a very simplistic manner. Because it is so tedious and common to need the count of the loop, the key value, or a pointer to the element being looped across, we give you implied declaration capability in the loop consruct.

It is a compact notation that has gone through many polishing steps, and is very ergonomic, easy to read, and downright handy. Loops are the bread and butter of computer software, and yes, there are a fair number of options (such as going in reverse).

Please take the language for a spin, you might like it.

magicmouse··on Beads: Computer language and toolchain
Beads is a tracked mutable state language. It used the State-Action-Model pattern (see sam.js.org), and is built from the start to support time travel debugging. Unlike `rr` and its sequel `pernosco`, it is not an instruction level reversibility, but a state change stepwise reversibility, which is efficient enough to stick around and be used in production use (not just in the lab).

There is a "blackbox_write' and 'blackbox_send" feature, which allows you to send session information sufficient to replay the user's session for debugging purposes.

This is a very powerful feature, and one that we are seeing more and more efforts to offer, because in a world with so many computers, being able to reproduce rarely occurring, data-dependent bugs, is very important.

magicmouse··on Beads: Computer language and toolchain
Beads uses the proven MODULE system of Modula-2 and Oberon. Of course we don't expect people to write in one single file. That the examples are small programs does not reflect the modular design of the language.

The entire purpose of the project is to build a world of software constructed by interchangeable parts. But to accomplish interchangeable parts, one has to make sure that there are as few external dependencies as possible, which is why the language has layout, drawing, event tracking, and database features pulled into the language, so as to not have one reaching outside, which would invariably break over time.

C proved that a standard library was a major feature of any language, and Beads has a well designed, but compact standard library, where you have a few functions, with lots of options so as to reduce the total number of functions one has to learn.

magicmouse··on Beads: Computer language and toolchain
Beads follows the State-Action-Model pattern, as described at sam.js.org. It is derived from the TLA+ work of Lamport. You have a mutable state, with pure code that renders the state on the screen, and then event tracking code mutates the state. What makes Beads unusual is that when you change the model, the screen layout section affected is automatically scheduled for refresh. This is possible because the state is being tracked
magicmouse··on Tesla is a bubble that will slowly deflate
Apple has a software ecosystem that makes their phones valuable. If it were running the same Android OS as Samsung, Apple would be in deep doodo, because the Samsung Galaxy Note 20 is an incredible phone, and easily the match of the iPhone, and i bought a Note 20 this year from Google for about $400. It is the software offerings that make the iphone great.

Elon's software is self driving tech, but he foolishly is refusing to add Lidar to his cars, when all the other companies know that Lidar is essential for vision impaired driving conditions. Once he loses the self-driving race, that is when Tesla will deflate.

magicmouse··on Tesla is a bubble that will slowly deflate
It is going to take a while for people to realize that Elon doesn't have magic dust. The auto market is a great deal more complex than the cellphone market. Apple only makes a half-dozen products in the cellphone space. They are used worldwide. Autos have to meet local standards, and fit 1000 different use cases. An intrinsically complex market, which is why even Toyota only has 10% market share.
magicmouse··on Tesla is a bubble that will slowly deflate
I expect Telsa to be like Apple, a premium brand that can command a good chunk of marketshare. Apple has about 20% of the world cellphone market; Jobs was shooting for 1%. He did much better than he expected. I think 20% of the world car market is optimistic for Tesla frankly given the national priority nature of the car biz. I think they will top out at less than 10%.

But if Tesla gets 20% of the world market share (and it will be a minor miracle to do this, Toyota only has 10% share!) it should only be worth 2x of Toyota. Right now Tesla has 600 billion market cap at net even 1% of global share, and Toyota has 10% of global share with market cap of 250 billion. So Tesla is overvalued more than 10 times, as if they had already won the battle, when in fact, they are still a young company.

The numbers don't add up. If Ford which sells 120 billion worth of vehicles per year is valued at 30 billion, then Tesla should be selling 2400 billion worth of vehicles, which is preposterous. Is a dollar earned by Ford somehow less valuable than a dollar earned by Tesla?

Tesla may not have a vehicle to compare with the Ford Bronco for 5 more years. In that time span, Ford will have sold 200k/year at an avg price of $40k. The Bronco is incredibly well designed; the best new car from an American company in decades (only the Corvette is comparable in quality of design). Tesla isn't even that good at design.

Tesla fan boys are drinking the kool-aid IMHO.

magicmouse··on Diamonds Are Bullshit
This article is pretty out of date. Man-made diamonds are now common, and the price of diamonds is about 1/3rd of what it used to be, and the margins at retail are considerably smaller. There are more countries producing diamonds, etc.

Also the pricing of diamonds is much less wild than he states. I think the author was not in the diamond business.

magicmouse··on Thoughts on Rust vs. OCaml
The Eve team had been using some other language, then Jamie Brandon fell in love with RUST,and it led to a split in the company. Rust is such a low level language; its primitive types are things like integers from 8 to 128 bits. but doesn't have any drawing, event mgt, or layout tools in the language. I can't imagine trying to build a graphical interactive product in Rust. It's similar to Modula-2 in terms of level, with one added trick, the memory borrow checking. I think of Rust as a one trick pony, that helps handle multi-threading memory management. Something that a browser maker would think ideal. I could never use it. Far too clumsy for building graphical interactive software, which is my wheelhouse.
magicmouse··on Show HN: A open source graphical translation management utility
This is an example of how you can use the Beads language to quickly make useful web apps, desktop and mobile applications. This particualr product was intended to be a desktop app. It needs to be a desktop app because it does a lot of file manipulation on your local drive, reading in and merging string files, etc.

You first click on the folder icon to locate the source code file that needs to be scanned for localizable strings. After it finds all the localizable strings, that becomes the "base language" for the product, and you can add more localizations. You can have as many languages as you want.

Each little colored chip in the display corresponds to a message. In the example below, we have just started the Spanish translation, and the first 3 translations we did were marked as "tentative" because we are aren't sure the translation is good. The green chips mean the translation is finalized. The white cells show missing translations, that need to be done.

The utility stores the external translation phrase dictionaries in Excel-friendly tab delimited format (sometimes call CSV format, although we aren't using comma-delimited for obvious reasons). We have buttons so you can do rough translations via Google Translate, which works remarkeably well for many computer oriented phrases. There is no substutute for a native speaker, but I have found google to be correct more than 80% of the time, so it definitely helps.

This is the handy graphical interactive localization utility for Beads, but could easily be adapted to some other source language, as it only needs to be able to parse enough of your source code to extract the strings that need translation.

It allows you to visit Google translate to get your translation started, and lets you keep track of your translation progress, add new languages, etc.

It is smart enough to detect when the original phrase has changed so that you might need to re-translate strings, if the meaning of the base language changed.

magicmouse··on Ask HN: Why can Apple out CPU Intel?
Intel saw the ARM juggernaut coming years ago after they trounced AMD, which was their only serious competition. They knew their chips were faster, but they took too much power for mobile devices. So they have been concentrating exclusively not on performance improvements, but in lowering power consumption, which they have done an excellent job at doing.

They have deliberately slowed down their tick/tock speed of development because they know they are reaching the end of the road, and will nothing to improve upon because the physical limits of silicon as a material are being approached. Other materials are possible, but very costly.

Apple wants to bring their huge iOS software library to their laptops. OSX has been declining for years as a software market, and fewer products are being made for it. In contrast, Apple has millions of excellent titles in IOS, but they all use ARM instruction set. So this allows them to unify the software availability.

The laptop computers Apple sells are a small part of their business, they know that in the future computers are a commodity and won't be profitable, but software will be, and they want to capitalize on their iTunes App Store which is the largest employer of independent software developers in the entire world. It is a bigger publishing entity than all of the US book publishers put together. With a 70% royalty rate paid to authors, it is also the highest paying publisher in the history of the world. It is common in Music and Book publishing to pay around 5% royalties. Steve Jobs really disrupted that industry with a new economic model! Hooray for Jobs! We sure miss him. I bet he would be opening his own bank and credit card, as that industry is ripe for revolution; the credit card companies are still ripping off businesses by taking 3% on a transaction, when 0.3% would be more reasonable given modern technology.

The ARM chips, just like intel chips, will be thermally limited in all these laptops. Its very hard to extract the heat without going to water cooling which nobody has the nerve to do.

magicmouse··on Moving from TypeScript to Rust / WebAssembly
Rust is extremely poor for web apps and graphical interactive software in general. Having been using Beads (a competitor to typescript) for the last few months, i couldn't possibly build my food ordering app quickly in Rust. There are hundreds of art assets to manage, and every screen has to automatically re-flow depending on the resolution of the device. Without a concept of DPI and the ability to measure text, and have a layout system, all of which is built into the Beads language, it would require a very tedious programming effort. Most of the time coding a graphical interactive product is making it look nice on all the different sized screens; Rust does nothing for this very time consuming task.

Typescript may force you to use the awful CSS, but having some layout system is better than none. And we could also talk about event management, and sync between client and server, none of which Rust is particularly good at.

magicmouse··on Whose Land – Indigenous Nations of North America
Indians entered america approx 8000 years ago. Many were nomadic hunter/gathering cultures, which have no defined territory. They followed animal herds, etc., so a map of their area is very approximate at best.

Recently the oldest skeleton was found, and it was caucasian! Caused quite a stir.

Remember that humans have been around for millions of years, and traveled in groups of around 200 people for most of that time. Organization came much later.

magicmouse··on Lisp as the Maxwell’s Equations of Software (2012)
LISP has an insidious parenthetical notation, and is well known to be a "write only" language, where nobody but the author can understand large programs written in LISP. It is avoided commercially for this reason.
magicmouse··on Show HN: A device simulator that cycles through many mobile device simulations
This is an example of an open source program called cycler that you can customize to run a program inside a simulator that shows what your program would look like when running on desktop and mobile hardware such as Kindle Fire tablets, Apple IOS devices, etc. You can set the time per device (currently 0.8 seconds), and after it runs through the portrait orientation, it switches to landscape. The only "gotcha" in this product is that you have to write in the Beads language.
← PreviousPage 2 of 3Next →