Intro to Hyperscript: Rethinking JavaScript
infoworld.com
infoworld.com
The big idea is a higher level and more expressive scripting language than js that embeds cleanly inline in html. It has integrated css query literals, relative location expressions (e.g. add .foo to the next .bar) and probably its most interesting feature, it resolves promises in the runtime so script writers don’t have to:
https://hyperscript.org/docs/#async
The syntax is based on HyperTalk, the scripting language for HyperCard, which was one of the first programming environments I used when I was young.
Again, not for everyone but I enjoy using it and intend on getting it to 1.0 this summer after I get htmx 2 out the door.
I don't understand this assertion at all. There is a grammar that must be learned, and it is different from existing solutions, which means most humans will need to reference something until they become familiar enough to work without documentation. I don't see how this is different than React, vanilla JS, or others. The benefits of this do not shine through for me.
Expanding the reliance on ”plain english” also risks hampering future development, since you’re mixing user-defined words with keywords in the same namespace. Taking ’mine’ as an example, would adding it to the language to fill out the first-person pronouns break existing scripts?
That critique aside, I really like it when people try ideas like this and fiddle with our expectations of what programming should look like. Erlang use a combination of commas, semicolons, and dots for defining a single line, the end of a block, and the end of a function. I personally prefer that to our more common curly bracket or indentation-based control flows. Go’s upper- and lowercase visibility modifiers also come to mind. Whatever you personally end up thinking about things like that, to me it’s sort of the hacker mindset at play. I end up liking that playfulness even when the result is not my cup of tea.
Once you get the hang of it, its pretty fun and a little surreal to write effective front end logic in what appears to be a natural language.
Highly recommend it for a prototype and think it was genuinely motivating because it made frontend logic more novel and fun.
It should be remembered that Hyperscript is meant to be paired with a technology like HTMX. I don't think the creator of Hyperscript would be suggesting to anyone that someone attempt to create a web application out of pure Hyperscript.
I wish HN supported markdown for code fragments but the 1st example of code in the post looks something like this:
div _="init fetch https://stuff as json then put result into me">Using fetch() API... /div>
and, IMHO, it's just gross. Worse in ~every way.
like this
make sure to make it a separate paragraph:blush:
Blazor lets you write C# that runs on the frontend. I’d expect to see more of that pattern before browser vendors replace JavaScript.
I'm talking about the language for building and adding interactivity to the webpages.
I think google tried to make Dart that language but it did not gain traction for whatever reason (I don't know the language) - maybe it coming from a single vendor had something to do with it.
What I was curious is that is this something that is even being discussed by the powers that be?
I'll take javascript with macros as a compromise. We could at least build DSLs with it.