Live data from Hacker News

Bonsai: Janestreet's UI Library

github.com

101–110 of 165 posts

Re: Bonsai: Janestreet's UI Library

#101
post #94

Earlier quoted context omitted.

Compiling TypeScript is just stripping out types

That is true only if you confine your TS code to be pure JS plus type annotations. There are TS constructs that require compilation into equivalent JS, such as enums and namespaces.

Are there any other?

Namespaces are heavily discouraged. Some teams still use enigma but most people in the know us unions of strings.

I know the TS team regrets enums and I have not seen any plans for adding additional keywords that break type stripping.

Re: Bonsai: Janestreet's UI Library

#102

It might be a very performant UI framework in OCaml, but all the UI elements look extremely unpolished to me, like what a really smart high-school kid would build the GUI for his side project on Windows in 90s. Thanks, I can use JS as a functional programming language.

Windows and especially Macintosh UIs from the late 90s/early 00s were by far the most functional UIs we've ever had since the dawn of the desktop era - user research was a serious discipline, accessibility was baked in to the frameworks, and the HID guidelines that devs adhered to gave us uniform conventions that we users could rely on.

If the biggest criticism of Bonsai is "it ain't pretty but it works", then long life to Bonsai - give me more, please!

Re: Bonsai: Janestreet's UI Library

#103
post #94

Earlier quoted context omitted.

Compiling TypeScript is just stripping out types

That is true only if you confine your TS code to be pure JS plus type annotations. There are TS constructs that require compilation into equivalent JS, such as enums and namespaces.

"fortunately" we can load swc compiled to wasm to deal with that.

Re: Bonsai: Janestreet's UI Library

#104
post #94

Earlier quoted context omitted.

Compiling TypeScript is just stripping out types

That is true only if you confine your TS code to be pure JS plus type annotations. There are TS constructs that require compilation into equivalent JS, such as enums and namespaces.

absolutely nobody used those outside of a language demo. We also got --erasableSyntaxOnly last year to remove them from the language. The TS team considers them “mistakes“ for a really long time now

Re: Bonsai: Janestreet's UI Library

#105
post #35

Can someone who understands web UI programming tell me if this would be good for my local agent to use to produce HTML based reports and outputs for me? Or for TUI outputs?

Probably not, because your agent won’t have much info about this tool in its training set.

i maintain a codebase that uses Bonzai (https://github.com/hazelgrove/hazel/); agent based development works just fine, though probably a bit more token churn

Re: Bonsai: Janestreet's UI Library

#106

Earlier quoted context omitted.

That is true only if you confine your TS code to be pure JS plus type annotations. There are TS constructs that require compilation into equivalent JS, such as enums and namespaces.

Are there any other? Namespaces are heavily discouraged. Some teams still use enigma but most people in the know us unions of strings. I know the TS team regrets enums and I have not seen any plans for adding additional keywords that break type stripping.

The other one I read about was parameter properties in constructors.

And thank you for the correction! It was quite a few years ago that I used TypeScript, and I think the landscape was different then.

Making things even fuzzier in my mind, this was an Angular project, and it was hard to keep track of what was Angular and what was TypeScript.

It sounds like people these days actively avoid the parts of TypeScript that require translation into different JS code.

Re: Bonsai: Janestreet's UI Library

#107
post #104

Earlier quoted context omitted.

That is true only if you confine your TS code to be pure JS plus type annotations. There are TS constructs that require compilation into equivalent JS, such as enums and namespaces.

absolutely nobody used those outside of a language demo. We also got --erasableSyntaxOnly last year to remove them from the language. The TS team considers them “mistakes“ for a really long time now

Thanks for the correction! It was a long time ago that I used TypeScript, and making things worse (for my memory) it was an Angular project.

So today, most people and teams avoid the parts of TS that require compilation into different JS, and --erasableSyntaxOnly lets you enforce this, right?

Re: Bonsai: Janestreet's UI Library

#108
post #104

Earlier quoted context omitted.

absolutely nobody used those outside of a language demo. We also got --erasableSyntaxOnly last year to remove them from the language. The TS team considers them “mistakes“ for a really long time now

Thanks for the correction! It was a long time ago that I used TypeScript, and making things worse (for my memory) it was an Angular project. So today, most people and teams avoid the parts of TS that require compilation into different JS, and --erasableSyntaxOnly lets you enforce this, right?

Exactly. There is plenty of code change however introduced by bundlers who do “bundling“, polyfill injection, minification, this kind of stuff.

Re: Bonsai: Janestreet's UI Library

#109
The docs directory happen to be missing, therefore the links to the quick guide and to "thinking in bonsai" pages from the readme are broken.

Also, I'm wondering how does bonsai-web update the DOM, is it via direct modification of the changed elements, or via some DOM differ? I'd say from direct update from a quick look at the source, but I'm unsure.

Re: Bonsai: Janestreet's UI Library

#110
post #94
post #93

Earlier quoted context omitted.

Clojurescript not ClojureJs, and Typescript doesn't run in the browser, it has the exact same issues/limitations: it must be compiled to JavaScript first.

Compiling TypeScript is just stripping out types

Isn't that like saying the Internet is only written in English if you strip out all the non-English. All C-style languages are fully cross compatible if you only use semicolons.

I can't write Typescript into a browser without cross-compilation and "stripping out types" involves parsing and manipulating code. That's a different language.

Post reply on HN