Hugo Hacker News

Show HN: Imba – I have spent 7 years creating a programming language for the web

micheljansen 2021-08-17 11:22:35 +0000 UTC [ - ]

I just want to compliment the OP on a very clear and comprehensive website at https://imba.io/. It clearly explains (by showing and telling) what Imba is, why I should care, how it works and how to get started. The floating demo applications even work well on mobile. Rare to see this level of polish for these things.

lhorie 2021-08-17 16:39:03 +0000 UTC [ - ]

I've noticed that some projects being complimented for having good docs come from CTOs (esbuild is another example). I'm hoping that by pointing out this little correlation, people might feel more inclined to spend more time on writing docs for their projects if they aspire to climb in the career ladder :)

jbverschoor 2021-08-18 05:07:13 +0000 UTC [ - ]

PostgreSQL, FreeBSD, Debian, rails all have superb docs.

Also, the software quality is high. This used to be the case for Apple and windows sdks. Not anymore.. now it’s “read the code“ or stack overflow

vijaybritto 2021-08-17 17:03:25 +0000 UTC [ - ]

Thats a very good point. In my company whoever writes the most valuable and extensive docs are looked up by people automatically. Either for clarifications or just networking. For the past couple of months I have been making devtools for QA and documenting them and just recently found out that every single team uses them and got recognized for it in the all hands!!

peakaboo 2021-08-17 18:25:35 +0000 UTC [ - ]

Any extra salary? No of course not. Lol.

lhorie 2021-08-17 18:36:36 +0000 UTC [ - ]

Anecdata, but after I released Mithril.js, I started getting contacted by recruiters from Bay Area companies. I now make 4 times as much as I did when I first started working on it. I know of other folks that got poached by high tech companies due to growing prominence in open source.

FWIW, my experience reflects GP that people really appreciate someone who takes the time to teach/help others. YMMV.

krageon 2021-08-18 11:52:36 +0000 UTC [ - ]

Working on OSS and working for high tech companies are two things that are diametrically opposite. The latter is not a reward for the former, unless you were only ever writing OSS to pad your resume.

lhorie 2021-08-18 18:01:52 +0000 UTC [ - ]

In my experience, it's not an either-or thing. I started my project to scratch an itch and only released it because I thought it could be useful to others. It originally didn't occur to me at all that my side project might influence my own career. But turns out that having a lot of stars on github attracts the attention of recruiters who use bot-based tooling to find talent and hitting HN front page attracts lurker employers. Getting stars is correlated with usefulness, and good docs correlate w/ usefulness as well. There doesn't need to be a direct causation relationship or even any specific intent, all that matters is what actually ends up happening when multiple correlations interplay.

Also, you can write open source software in big tech companies and even be paid to do it (React core team is a good example). TC39 folks spending time moving the Ecmascript standard forward is another example of staff/principal engineers doing citizenship-oriented work in order to get recognition for impact at FANG L6+. Being snarky about it doesn't change the fact that these sorts of symbiosis exist.

jokethrowaway 2021-08-18 08:38:09 +0000 UTC [ - ]

And it's very well deserved, Mithril is amazing!

I never had a really successful OSS project but I have a few friends who had or were maintainers of successful projects.

One got poached by FB, another one is a contractor at a higher than average rate.

xwdv 2021-08-17 20:12:06 +0000 UTC [ - ]

Was your original salary at the average market rate?

vijaybritto 2021-08-17 19:34:44 +0000 UTC [ - ]

Ha ha no. I didnt even have a discussion about that. I think i need to talk to my manager at some point. But he has been very supportive!

sumedh 2021-08-19 01:54:43 +0000 UTC [ - ]

Just out of curiosity, what is your age? You can give a range if you are not comfortable sharing the exact number.

gregsadetsky 2021-08-17 15:05:29 +0000 UTC [ - ]

Very true!

One small note to the author: the “We are hiring” at the very top, on mobile, is a bit broken. It appears on three lines. It looks great in mobile landscape, but not in mobile portrait mode.

nailer 2021-08-17 13:14:48 +0000 UTC [ - ]

One piece of feedback: it took me a moment to work out what 'pt', 'o' and 'fs' were. Single character variables are fine for algorithms but for demos you really want to use actual words.

rawoke083600 2021-08-18 07:29:24 +0000 UTC [ - ]

Oh YES ! 100% - or if the demo spans "multiple files" but the code-snippets doesn't include a filename comment.

I.e //app.js ...

//my-todo.js ....

linux2647 2021-08-17 14:18:17 +0000 UTC [ - ]

I’d agree If I’m using css daily I might know what these mean, but I only edit css once in a while, so most of these properties are lost on me

greggturkington 2021-08-17 16:04:28 +0000 UTC [ - ]

I write CSS everyday and I had no idea what "fs" meant.

"fz" is the typical shorthand used for font-size (at least by Emmet-style autocompleters). "fs" is used for font-style instead.

scotty79 2021-08-17 21:21:59 +0000 UTC [ - ]

Those shorthands are optional.

nailer 2021-08-18 12:44:40 +0000 UTC [ - ]

Great but they shouldn’t be used in demos.

antattack 2021-08-17 15:36:36 +0000 UTC [ - ]

One thing that site does not specify is the Imba's license (MIT)

Bellamy 2021-08-17 18:12:16 +0000 UTC [ - ]

What does it mean for projects build using imba?

lhorie 2021-08-17 19:01:54 +0000 UTC [ - ]

Nothing you should worry about. MIT is a very permissive license.

Noumenon72 2021-08-18 17:13:00 +0000 UTC [ - ]

You have to worry about including the copyright and license in your software. I've never seen a project do that so I'm not sure how to do it or if MIT is actually usable.

lhorie 2021-08-18 17:37:18 +0000 UTC [ - ]

The attribution clause only applies to the licensed code, not derivatives. In practice, all this means is that you can use an unmodified copy of Imba (which contains its own license/attribution language) without issues.

What's not cool is to fork Imba, remove the attribution to the original author and pass it off as your own code.

knidoyl 2021-08-18 07:39:39 +0000 UTC [ - ]

On side note, if you ever wonder what a licence means or do there is this website that help clarify this : https://tldrlegal.com/

system2 2021-08-17 15:49:03 +0000 UTC [ - ]

Exact opposite of Elastic.co.

meepmorp 2021-08-17 18:00:26 +0000 UTC [ - ]

Every time I consult their docs, I feel like I have less of a handle on the topic than when I started.

vosper 2021-08-17 18:55:17 +0000 UTC [ - ]

I think this might be partly due to the query language being JSON? It makes every example huge and hard to understand. JSON is a serialization format that's human-readable, it's not a human-first language. So it's a pity that's how you're expected to write searches (I know they have some SQL support now, but I've never seen it in the docs)

konart 2021-08-18 08:20:29 +0000 UTC [ - ]

I don't think this has anything to do with json or examples in general. At least not for me.

Quite often after reading their doc I just don't understand what result I should expect. Also the whole documentation simply lacks sane navigation. It's almost impossible to find anything there without google.

In 50% of cases this is how it works for me (exaggerated):

Question: how do I sum two integers?

Expected Answer: You should use SUM(). The result of the function is the sum of two integers. Examples:

2 + 2 = 4

2 + (-2) = 0

-1 + (-1) = -2

Answer from Elastic docs: Well, you should execute this query agains this API, which will launch X subroutines in Elastic engine and the final result will be the result of of the aggregation of function defined by the Ex with En+1 being your query's body field Y with respect to url query param N.

ziftface 2021-08-17 18:42:13 +0000 UTC [ - ]

Hate to pile on, but I'm glad it's not just me. When I read their docs, I just get the feeling that I'm kind of dumb, or I just don't have the context they expect me to have.

konart 2021-08-18 08:23:45 +0000 UTC [ - ]

This. It almost like their docs is a cheat sheet for the Elastic devs, not for the end users.

js6i 2021-08-17 21:30:50 +0000 UTC [ - ]

Is it just me? This website is super laggy on my PC (which can run modern games just fine). Hardly hits 50 fps when scrolling. How slow can one get and still claim to be fast?

Shorel 2021-08-17 23:27:05 +0000 UTC [ - ]

Firefox 91 on Windows. 2011 CPU. Radeon RX 570 GPU.

I have a low spec PC, and it is running just fine.

Maybe some extension slows down your Firefox? I don't use an anti-ads and anti-spam extension, I deal with that via hosts file.

p1necone 2021-08-17 21:34:28 +0000 UTC [ - ]

Not just you, I have a pretty beefy desktop and it's noticeably laggy when scrolling for me too.

EDIT: ah - butter smooth in edge (and presumably chrome too), but laggy in firefox.

p1necone 2021-08-17 23:50:23 +0000 UTC [ - ]

Further update - it turns out I'd turned off Hardware Acceleration in FF to avoid issues that Windows has when you have GPU accelerated content on two separate monitors with different refresh rates.

It's really bad with Hardware Accel turned off, but it's still a bit laggier with it on compared to chrome/edge.

somebee 2021-08-18 07:20:42 +0000 UTC [ - ]

Yeah, it's not really optimized for that. The floating labels over the code examples are offset in 3d space (for a subtle parallax effect while scrolling), so when HW acceleration is off it may end up repainting the page on every scroll. The effect is probably not worth the tradeoffs :)

dtagames 2021-08-17 14:49:50 +0000 UTC [ - ]

Very true! It's a great landing page for a language that gets into the meat of it right away with clear examples in code blocks. Nice work.

fwip 2021-08-17 20:29:41 +0000 UTC [ - ]

I love the font chosen for the demo code, the descender on the f is very charming.

cutemonster 2021-08-17 22:10:39 +0000 UTC [ - ]

I thought so too

somebee 2021-08-17 09:42:47 +0000 UTC [ - ]

cies 2021-08-17 14:16:51 +0000 UTC [ - ]

Thanks for sharing, I really like projects like this. And the website is really informative.

I find it less of a new language and more of a JS preprocessor, removing lots of the cruft and integrating XML-tags and CSS in a very neat way.

What I miss:

1) I feel the web is shifting to more type checking. TS, Elm, Kotlin.js... I personally also prefer more typesafety, especially if the project grows in LOC/team size.

2) Compared to JSX, Imba does a much better job in integrating adjacent technologies. Though I much prefer these to be integrated in an eDSL fashion. For example how Elm does HTML templating (in Elm) or Kotlinx.html[1].

Just taste i guess. Good luck with yr project!

[1]: https://github.com/Kotlin/kotlinx.html

gdotdesign 2021-08-17 17:07:54 +0000 UTC [ - ]

If you want something like that, check out Mint (www.mint-lang.com) :)

cies 2021-08-18 07:52:30 +0000 UTC [ - ]

Interesting. Does not tick all the boxes, but certainly interesting and, imho, very similar to Imba but with a bit more typing.

davedx 2021-08-17 14:20:51 +0000 UTC [ - ]

I have to say, I don't know if I'll use this language as I'm not a fan of Ruby syntax really, but the landing page presenting Imba is just phenomenally well done.

1. The live demos that you can easily click to open and edit the examples (but doesn't load in a slow, clunky, ad-infested live code editor like some sites do)

2. Those arrows pointing out language features, so compact, succinct and useful

3. A short list of very well thought-out demos showing off different aspects of the language. (I almost laughed with pleasure at the "autorender=1fps" part).

Great work.

Griffinsauce 2021-08-17 14:29:03 +0000 UTC [ - ]

Totally agree, this is obviously the work of someone who knows how to teach.

pier25 2021-08-17 14:51:54 +0000 UTC [ - ]

The authors of Imba care a lot about education and are working on Scrimba.

dang 2021-08-17 18:14:21 +0000 UTC [ - ]

Past related threads:

Launch HN: Scrimba (YC S20) – Interactive video for learning to code - https://news.ycombinator.com/item?id=24579699 - Sept 2020 (72 comments)

Imba – Create complex web apps with ease - https://news.ycombinator.com/item?id=20487972 - July 2019 (36 comments)

Imba the new JavaScript based language having Python,Ruby inspired syntax - https://news.ycombinator.com/item?id=18487942 - Nov 2018 (3 comments)

IMBA the new programming language for web apps - https://news.ycombinator.com/item?id=17505816 - July 2018 (2 comments)

Imba – 10 times faster than React - https://news.ycombinator.com/item?id=14837231 - July 2017 (1 comment)

Imba: A new programming language for web apps - https://news.ycombinator.com/item?id=10901054 - Jan 2016 (128 comments)

Imba - create complex web apps with ease! - https://news.ycombinator.com/item?id=10863827 - Jan 2016 (8 comments)

Imba – A new programming language for the web - https://news.ycombinator.com/item?id=10091454 - Aug 2015 (171 comments)

mstade 2021-08-17 10:44:03 +0000 UTC [ - ]

This looks very cool, thanks for sharing!

I took a cursory look at the docs and it looks like async/await is pretty much directly analogous to how it works in JS, with the difference that you don't need to mark functions as async in order to use the await keyword. Does this mean that if you use await in any function then any other function calling it will have to be refactored to add an await keyword, just like you have to refactor any call sites in JS if you make a function async?

I remember seeing someone here on HN showcasing a language where they did the opposite, making it so that await is implicit, so calling fetch or anything async doesn't require an additional keyword, and functions don't need to be refactored just to sprinkle async/await everywhere. I'll see if I can find that language again, but it seems to me there may be some idea sharing between the two that could perhaps yield some amazing features...

derangedHorse 2021-08-17 11:07:02 +0000 UTC [ - ]

Asynchronous code can sometimes be difficult to write efficiently so having implicit awaits might help with avoiding accidentally made fire and forget calls. An interesting concept might be to explicitly call a function as asynchronous with a new keyword flipping the typical usage of ‘await’. I’d still advocate for the usage of ‘async’ in function signatures though as it helps when reasoning through an asynchronous code base.

coding123 2021-08-17 13:54:31 +0000 UTC [ - ]

I think it would be awesome for Typescript to introduce sync functions. So think of that as completely flipping the dialog on async/await to await by default:

    sync function x() {
        const taco = getTaco() // getTaco returns Promise<Taco>, but taco automatically resolves it in a sync function
        // Similarly, you can tell it to not wait
        const ptaco = nowait getTaco();
        // ptaco is a Promise<Taco>
        const taco2 = ptaco; // taco2 is a Taco because the ptaco symbol is treated like (await ptaco) without nowait
        // Also, since ptaco has already "awaited", future
        // access would be 0 delay as it's basically a resolved promise.
    }
Of course, similar to an async function, sync functions would also return a promise.

Probably a dumb idea but I would use it personally.

jessmartin 2021-08-17 16:51:13 +0000 UTC [ - ]

I literally googled to see if this existed last week. Would also use!

Osiris 2021-08-17 19:38:09 +0000 UTC [ - ]

I started working in node around version 0.8, before both native Promises and async/await.

I worked with guys that started after async/await.

The new guys just think of everything like it's synchronous. They don't understand Promises. They never look at code and think "I can run this in parallel with Promise.all and a reducer". They just await each thing one at a time.

So, I'm not sure the async/await annotations are really helping us when devs just use them like decorations that just have to be there for it to work.

tsian2 2021-08-17 23:06:57 +0000 UTC [ - ]

I'm new to NodeJS but it was my understanding that using await like that would help by not blocking the thread, leaving node free to process other requests.

gregoryjjb 2021-08-18 05:48:53 +0000 UTC [ - ]

await won't block Node from handling other requests but it will block the thread that is awaiting. For example, these will execute one after the other (the "bad way"):

  await slowThingOne();
  await slowThingTwo();
but these execute in parallel, awaiting until both are finished (the "good way"):

  await Promise.all([slowThingOne(), slowThingTwo()]);

hmsimha 2021-08-18 07:35:44 +0000 UTC [ - ]

Minor clarification, the latter example will only await until both have resolved *or* one rejects. To await the resolution of all promises, you should use the truly gamechanging `Promise.allSettled` , though you will have to transpile it if it's not supported by your target environments.

z3t4 2021-08-17 20:31:46 +0000 UTC [ - ]

Don't forget to put each await in a try/catch. You are handling all errors aren't you!? ;)

inlined 2021-08-17 17:01:42 +0000 UTC [ - ]

But then how do you gather promises together to run them in parallel? For sophisticated apps this is crucial.

Osiris 2021-08-17 19:34:55 +0000 UTC [ - ]

I would assume they would create an array with a bunch of Futures that would resolve at the end of the assignment, or the std lib would offer some ability to explicitly make things run in parallel.

hashkb 2021-08-17 18:13:00 +0000 UTC [ - ]

Or queues, graphs, or other chaining behavior I can't predict you'll need as a tool author.

mstade 2021-08-17 12:00:05 +0000 UTC [ - ]

This is exactly how I remember it working in the language I mention (which, by the way, is called hyperscript[1].) The semantics where flipped such that you'd explicitly mark calls or functions as async, rather than await, if you wanted them to run asynchronously.

I run into subtle bugs all the time due to missing awaits, it's incredibly frustrating.

[1]: https://hyperscript.org/posts/2021-04-06-aysnc-transparency-...

williamdclt 2021-08-17 13:22:03 +0000 UTC [ - ]

> I run into subtle bugs all the time due to missing awaits, it's incredibly frustrating.

If you use TS, ESLint's `no-floating-promises` rule (or the equivalent in other linters) is _such_ a requirement

masklinn 2021-08-17 15:21:27 +0000 UTC [ - ]

That assumes all promise-generating code can be and is properly annotated, though.

yunyu 2021-08-17 16:21:52 +0000 UTC [ - ]

Typescript will cover this!

masklinn 2021-08-17 18:58:43 +0000 UTC [ - ]

Typescript lets you call into un-annotated libraries or annotate things as `any` or whatever.

tekknik 2021-08-18 00:42:45 +0000 UTC [ - ]

minxomat 2021-08-17 10:53:41 +0000 UTC [ - ]

That pretty much describes Lua.

mstade 2021-08-17 12:00:59 +0000 UTC [ - ]

Thanks for mentioning it, I don't know much about Lua. I found the language I was thinking of, it's called hyperscript. Here's an article about how async works in that language: https://hyperscript.org/posts/2021-04-06-aysnc-transparency-...

masklinn 2021-08-17 15:18:56 +0000 UTC [ - ]

So… bog standard blocking interface, except it compiles to JS so it has to "surface" the async during the compilation process?

recursivedoubts 2021-08-17 14:06:06 +0000 UTC [ - ]

https://hyperscript.org

and its async transparency in particular:

https://hyperscript.org/docs/#async

hyperscript isn't a general, full-stack programming language though, it's focused on pure front end stuff, sort of a modern jQuery replacement.

brundolf 2021-08-17 18:22:41 +0000 UTC [ - ]

I disagree with a couple of the choices made here, mainly the (apparent) lack of static typing

But with that said, the author has done an amazing job with the website and materials, and it's clear this language has a lot of upsides given that it's already been running in production as much as it has

I am also a big believer in the premise that we need a dedicated Web Language that incorporates client/server and logic/markup/styles into a coherent package (disclosure: I'm also working on my own version of that)

All in all, cool stuff, lots of takeaways to be found here at the very least

dt2m 2021-08-17 11:03:19 +0000 UTC [ - ]

Looks cool. I'm honestly curious as to why a lot of new web languages/frameworks are mixing logic and content in the same file again though. The distinction between HTML, JS and CSS always made perfect sense to me. Anyone care to enlighten me?

dathinab 2021-08-17 15:55:23 +0000 UTC [ - ]

(Disclaimer not a web but backend dev.)

In my experience it's much more important to modularize/capsulate/segmentate by groupings of business logic then by groupings of implementation details.

Applying this to web applications (not simple text focused websites) this would mean that its preferable to have everything (HTML+JS+CSS) related to a specific widget (e.g. counter) in one place, instead of splitting it into many parts sprinkled across many files potentially in different folders. Similarly you also would e.g. want the CSS to be encapsulated as to the component as far as possible.

Its a bit of a different matter for classical html documents where the HTML made sense without JS or CSS and both where thinks you added "on top" to "just make it a bit nicer" but this isn't the think anymore for modern webapps (and many fancy websites).

Also if you work in a situation where you have many huge teams working on the same UI at the same time touching the same logical component (but normally different aspects of it) then having a more clear segregation can also make sense, but >99% of all companies are not ever in that situation.

This is also for example a major critic I have with react, it splits one logical unit across different files making it much harder to reason about it for the benefit of adding a bit more decoupling which isn't needed by >99% of dev teams.

alanbernstein 2021-08-18 03:41:41 +0000 UTC [ - ]

Interesting, that makes sense. I'm thinking about a CLI analogy: you could write a program in C for the logic, some table specification markup language for the terminal layout, and a stylesheet for the colors and text styles. It would feel so cumbersome. The distinction between creating a document and a program is critical.

resonious 2021-08-17 11:16:25 +0000 UTC [ - ]

Personally I've always been kind of confused by the common best practice of separating everything. React and Vue single file components made so much sense to me.

I guess if I were to rationalize my position, I'd say it's because I have a hard time finding related things when they're separate. If a button or "a" tag have a special click handler, I want to know when looking at it. If it just has classes, then I don't know if that are for style or if they're for behavior. I know there are some conventions out there where you prefix classes with "js-" etc, but if you just use "onclick" then it's obvious and you don't need a convention.

lhorie 2021-08-17 15:48:04 +0000 UTC [ - ]

Personally I think it's not so much about separation of concerns/technologies per se, it's that this debate boils down to a different debate under the hood: the one about folder-by-type vs folder-by-feature[0].

The gist is that folder-by-feature is generally preferrable because it requires less context switching (in the literal sense of jumping between multiple different far away folders and scanning each for the thing you're looking for)

Single file components force you to organize code in a folder-by-feature structure, to a large extent. You can use folder-by-feature structure alongside with separation of technologies, it's just not that common to see it because the tooling to support it is not quite as optimized.

[0] https://softwareengineering.stackexchange.com/questions/3385...

cableshaft 2021-08-18 13:43:24 +0000 UTC [ - ]

> You can use folder-by-feature structure alongside with separation of technologies, it's just not that common to see it

Angular is a pretty good example of this. The HTML, CSS, unit tests, and code are all in separate files, but they have the same base name and are grouped together in the same place.

tiborsaas 2021-08-17 11:23:39 +0000 UTC [ - ]

It's fine if you have a few colors, but with 50+ lines of SASS/component I'd rather have them separately.

> I have a hard time finding related things when they're separate.

Store them in the same directory?

I agree on the events/business logic that they make sense to couple with the template code.

Mavvie 2021-08-17 15:17:23 +0000 UTC [ - ]

With something like Svelte, I see no reason an editor couldn't let me choose if I want to see the JS/HTML/CSS in the single file (as it is on disk) or split it up into separate editor tabs for me.

scns 2021-08-17 14:12:33 +0000 UTC [ - ]

And have to switch between three files back and forth?

tiborsaas 2021-08-17 14:48:59 +0000 UTC [ - ]

I usually split my IDE to multiple planes. A 4k, large monitor helps though :)

arodyginc 2021-08-17 14:56:51 +0000 UTC [ - ]

For their demo https://imba.io/ they put styles in a separate file, how so?

progx 2021-08-18 08:16:20 +0000 UTC [ - ]

Or up and down in one file.

klibertp 2021-08-17 14:24:40 +0000 UTC [ - ]

What? How is that a problem, why would it be something that's best avoided, and why simply displaying all three files at once in one of a million ways available is not a solution?

kingdomcome50 2021-08-17 15:02:46 +0000 UTC [ - ]

I don’t see any added value of separating pieces of a component into different files. The CSS, JS, and HTML are all logically coupled no matter how you organize them.

At best you will achieved a few smaller files. At worst you make working within the system a real pain.

dec0dedab0de 2021-08-17 19:11:08 +0000 UTC [ - ]

I think its much more of a pain to have more than one language in the same file, but I suppose that's a matter of preference.

Some practical reasons for separate files, off the top of my head:

In-lining JS, and CSS means enabling unsafe-eval, which can open up XSS vulnerabilities if you use any content from users or gathered from a source you don't control. You could also do the unsafe-hashes, but that's kind of a pain.

If you're not making a SPA, it would not be fun to copy the CSS to all of your files.

If you do not couple your CSS to your site, you can reuse it across many sites and have the same style. Say if you have separate site for your blog, but want it to look the same as your main site.

If you're working on a team splitting things up into separate files will avoid some merge conflicts.

Chances are they will not be updated all at the same time, so caching would speed up page load times, as the user would only have to download the changed files

klibertp 2021-08-17 16:01:48 +0000 UTC [ - ]

I don't see a difference between switching between files and switching between positions in a file which is longer than a page or two. In both cases the switching is not free - unless you do something about it (like spliting panes/windows in your editor; bonus: it works for both separate files and long files in the same way!). It's also trivial (well... depending on the IDE/editor I guess) to make it open all 3 files when any one of them is opened and/or to make a command to cycle between files, similarly to how you can switch between .c and .h files in most environments.

For files where the logic, structure, and styling fits on a single page - yeah, splitting it into separate files doesn't make much sense.

> At worst you make working within the system a real pain.

That's what I don't understand - what pain? That it's better not to work with it using nano or notepad? It simply looks like a pain I would never experience, and I'm wondering if I'm right.

kingdomcome50 2021-08-17 21:15:44 +0000 UTC [ - ]

You are only imagining the case when you have already opened/identified all of the files you intend to work on.

Actual workflows diverge significantly from the above. It's a matter of cohesion. Yes, co-locating each of the files (and only these files) in a single "component" directory can help ease navigation and discovery, but most of the time it's just easier to keep everything as cohesive as possible.

RussianCow 2021-08-17 19:52:46 +0000 UTC [ - ]

> I don't see a difference between switching between files and switching between positions in a file which is longer than a page or two.

Exactly! By putting everything into one file, you give the reader the option of splitting their view if they want, or looking at the file all in one pane; with multiple files, you have to have each file open independently. Editors give pretty nice ways of navigating to specific functions/methods/points within a file these days, so traversing a large file is not really an issue IME.

Personally, I don't understand the fascination with splitting everything into super small files; given the large number of files I generally have open in my editor, I'd rather look at one file with 1k lines of code than 3 files with 100-500 each. With separate files, if I'm trying to debug something that touches three different components, I need to have 9 files open instead of just 3.

klibertp 2021-08-17 20:45:22 +0000 UTC [ - ]

This really depends heavily on how you use your editor, on its specific features. For example, you qualify the "navigating to specific definition" with "within the file", but in my editor jumping to definition across multiple files works exactly the same way as within a single file, and due to a stack of jumps that you can pop, there is usually no need to know or care in which file you are currently, or were previously. Similarly, you mention "large number of files you have open in your editor" as if that was a problem of any kind. For me, it isn't - I have 60+ files open frequently, but I have quite a few ways of searching for/jumping to a specific file, buffer, or content that I want to see, and I never need to cycle through open files or tabs. Most of the time I don't have to care if the file is open - there's literaly no difference in the method(s) of getting to a file because of its state (open or not).

The differences between my and your environments mean that our preferred workflows differ, too, because what can be problematic for you can be easy for me, and vice versa.

That being said, I also don't advocate "splitting everything into super small files". Splitting a file that is less than a "page or two" (I see 61 lines of code on one page, so less than 120 loc) is a mistake and should be done only in special circumstances, while files that grew larger than 500 loc should be refactored if it makes sense. Files over 1k loc have to be split. That's the policy we use at work, and I think it results in a pretty nice and easy to navigate code bases.

Back to the editors, though: as long as the codebase uses a convention - any convention - consistently, you can make it nice to work with, by altering your environment to match the convention. This is where the more configurable and easier to script editors win big time - if there's something in the codebase you don't like, and can't change, you can script it out of sight and out of mind easily. Coming from such an editor, I personally don't have a strong opinion on how the codebase should be structured (which includes the lenghts of files) - I do have some preferences, but I'm not very attached to them. That's just to signal that I'm not the one of people "fascinated" with splitting files for the sake of it :)

RussianCow 2021-08-17 21:43:21 +0000 UTC [ - ]

> For example, you qualify the "navigating to specific definition" with "within the file", but in my editor jumping to definition across multiple files works exactly the same way as within a single file

If your convention involves using the same name throughout different files (e.g. every component has a `styles` object), this becomes cumbersome to do. (Arguably, that's a problem with the convention, but sometimes you don't have control over this...)

Other than that, I mostly agree with you and fully admit that it's a matter of preference and highly dependent on your workflow; I was just trying to point out that a single file is generally easier to navigate with an out-of-the-box experience in most editors. I also agree with your stance on when to split files, with a small caveat: even when splitting something into multiple files, I still tend to group them by their high-level function as opposed to by "type". In other words, I would rather split a helper component into its own file with its own styling in the same file, rather than split all of the styling into its own file. (Of course, sometimes you really do have 800 lines of styles, in which case they probably need to be in their own file regardless.)

> That being said, I also don't advocate "splitting everything into super small files".

That's great! :) I see this too often in frontend web development, though: people will go out of their way to keep their files as small as possible to an irrational degree—almost as if they are trying to ensure that you can view every file in its entirety without scrolling.

tannhaeuser 2021-08-17 11:44:24 +0000 UTC [ - ]

> The distinction between HTML, JS and CSS always made perfect sense to me.

Really? HTML is already heavy on syntax, and the whole point of SGML-style angle-bracket markup is to invisibly structure text hierarchically and sneak in rendering properties or other "metadata" not rendered to the user, via attributes. In which universe, then, has it ever made sense to write

    <div style="color: red">
rather than

    <div color=red>
in a document representation language? Let alone today's CSS atrocities. Mind, I'm not talking about CSS' out-of-control layout model complexity, but inventing a new syntax (or a thousand microsyntaxes really) on top of already syntax-heavy markup.

If you think about it, CSS appears to have gotten these ninja super-powers because HTML was locked in a decade-long stagnation while W3C was busy with XML, RDF, and whatnot. Then again, in the last decade using <div>s for nearly everything was frowned upon, so with the precedent set in the decade before, CSS just had to re-order, re-place, re-arrange ad absurdum without any discernible mental discipline. Or, maybe the CSS WG people just couldn't stop.

The end effect is that CSS isn't approachable for even seasoned graphic artists let alone laymen; another effect being browser complexity resulting in monopolies.

A false separation-of-concerns narrative has ruined many languages and approaches (such as enterprise OOP); for the web it was particularly idiotic given it's founded on composable documents.

JS? Once it was out there, evolution of HTML and declarative UIs basically stalled because there wasn't anything you couldn't do using JS. Nevertheless, CSS had also grown into outlandish complexity. Basically, the "web stack" of today is what any standardization effort should've avoided.

dtagames 2021-08-17 14:56:42 +0000 UTC [ - ]

> The end effect is that CSS isn't approachable for even seasoned graphic artists let alone laymen; another effect being browser complexity resulting in monopolies.

This is so true. CSS has become a multi-headed Hydra whose parts appear completely unrelated to each other. I've been a developer and designer for more than 20 years and I have no idea what the parameter names and orders are for position, versus grids, versus float, etc. It's parameter soup. Who said the hardest part of programming is naming things? The CSS folks didn't get the memo.

To do any real work with CSS means you have memorize a bunch of conflicting weirdness and/or keep a reference page open at all times. The idea of CSS frameworks to simplify or fix this doesn't work because, in order to write or debug what you create in those frameworks, you must know regular old CSS!

It's turtles all the way down.

tekknik 2021-08-18 00:54:31 +0000 UTC [ - ]

> To do any real work with CSS means you have memorize a bunch of conflicting weirdness and/or keep a reference page open at all times.

I agree with CSS being complicated, but this statement is true for pretty much everything. Not a day goes by I don’t close 20+ reference tabs at the end of the day, not counting what I closed throughout the day. It’s simply impossible to be a polyglot and not use references.

Dah00n 2021-08-17 12:33:49 +0000 UTC [ - ]

Not that I disagree that what we have today is a big mess but this sounds to me almost like the philosophy behind the old PHP version that everyone seems to hate. Personally I'd much rather have everything separated in a better HTML/CSS/JS than HTML+CSS+JS in one big pile. But I'm also not a fan of JavaScript at all, especially not of the hyped "one framework today, another tomorrow" that is JS development today. In my opinion in that area we are moving backwards very quickly.

mdtusz 2021-08-17 19:18:28 +0000 UTC [ - ]

I think we're well past the period of a new framework every week - at least in a "real world" sense. Nearly all companies will settle on react or vue these days with a long tail choosing others, but this is no different than any other part of software development - lots of different databases, web frameworks, auth libraries etc all exist as well and are used.

Most of these "new" frameworks are more because someone wanted to scratch an itch or solve a specific problem they had, and frontend code simply lends itself well to being open sourced. If you don't like the new js tools that are made, just ignore them.

nwienert 2021-08-17 17:10:09 +0000 UTC [ - ]

Totally disagree as someone who grew up building websites as “cleanly” as possible, and now has spent many years doing all in one: the all in one is simply better in every way, it logically makes much more sense to group by component than by arbitrary style/structure/logic which just isn’t the right separation for many reasons that are written more fully in many places.

I also made SnackUI to solve the last problems of fully inline styles: namely to make them work 100% between React Native and Web, to make them extract to atomic CSS on web automatically, to optimize even conditionals into CSS, and finally to make media queries and themes work the same between Native/Web. We’re launching a very large app with it here in not long, and I absolutely love how clear it is to work on.

https://github.com/snackui/snackui

q-rews 2021-08-17 20:04:32 +0000 UTC [ - ]

Ok CSS sucks but what are the alternatives? What I see on other platforms requires some sort of WYSYWYG, which you can sort of do in the browser as well. They all generate XML, which I doubt is any more writable than CSS.

What I’ll forever complain about (as a front end developer) is that there’s no distinction between a document and an app. You can start from a blog post and turn it into a rocket just by throwing more JS at it.

I think only Google can fix it at this point:

- come up with a better alternative for apps

- reward websites that are content-only (or are guaranteed to support Reader view)

Now you could start to have simple documents and a powerful app platform.

Unfortunately this is hard to do as most developers will call bloody murder. So let’s enjoy CSS for the next hundred years, shall we?

ollerac 2021-08-17 11:35:58 +0000 UTC [ - ]

It's because of components.

Web app dev has started focusing on single, separate, reusable components instead of trying to design everything on the page at once.

Often, in these components, the HTML, CSS, and JS is still separated, but now (theoretically) you can plug that component in anywhere (even a different app) and, as long as you feed it the right data, it should just work.

klibertp 2021-08-17 14:19:29 +0000 UTC [ - ]

> It's because of components.

Replying to you because this is the shortest expression of this sentiment, expressed in many different comments:

No, it's not because of components. It's because of emulation of components by means of precompilation or JS execution. First-class components are available already, there's no reason to continue to emulate them, unless you need backward compatibility, or have another goal other than separating components.

It's also not about "components" in the meaning of "widgets" - reusable bits of content+view+behavior - because these can be trivially made with standard HTML + CSS + jQuery plugin. It was done since before the DHTML was a thing (hello <iframe>!).

Instead, it's all about web apps, how they achieve responsiveness, and the fact that the more the framework knows about the content (including how it should look in all its states), the easier it is to optimize it consistently. I get that, it's ok for web apps, and it gets better the more nice syntax you throw at the problem (up to a point, as usual), because once you have enough of syntax extensions to replicate the important features of HTML and CSS, you can go absolutely nuts on the actually generated code and nobody would care.

On the other hand, using web app frameworks to write web pages is bad - do you really need to optimize for responsiveness if almost everything you see on the page has exactly one (or two, with hover) state? The same is probably true for languages designed for web apps: using them to write web pages can be tedious and more trouble than it's worth.

TLDR: it's because ~components~ web apps.

cwizou 2021-08-17 13:52:49 +0000 UTC [ - ]

The pragmatic answer is that, for the the large companies usually behind those frameworks, they can have many independent teams that are working on split components, without marching on each other's toes.

But to me, there's a parallel to be made between both the newer trends of components and micro-services, and the old idea of Object Oriented Programming. In all cases, you get sold on the idea that everything should be cut down into tiny pieces.

Theoretically the separation of concerns has tons of merits, but in practice there are a lot of rough edges when those separate pieces have to interact with each others.

And the tradeoffs may not always be worth it when your project isn't on the scale of those large companies (it very rarely is).

sam0x17 2021-08-17 15:31:11 +0000 UTC [ - ]

I agree. The real difficulty in software engineering is at the seams where systems or components have to interact with other systems/components. The more seams, the more difficulty.

The key though is that componentization is useful when you find yourself writing the same code over and over again. That's where DRY steps in and says yeah this should be its own component.

This is one reason monoliths are great as an app structure, because they let you be as DRY as possible and have as few seams as possible (making a component within a monolith doesn't create an external dependency, no seam). Additionally, there are options nowadays (ruby on jets for example) that let you have a monolith repo structure but each controller endpoint gets deployed as a separate lambda. So you get to have your cake and eat it too.

The analogy really does work fairly well at every level of software engineering, from frontend components to backend services.

cwizou 2021-08-17 15:55:25 +0000 UTC [ - ]

Yep, the way I see it is, how much abstraction are you willing to accept.

Intuitively you may not want too much, until you find out that maybe you could have needed a bit more because of the repetitiveness. So frameworks that give you the option to gradually increase it when you need are the best. And when the documentation follows those patterns it's really great (I'd put Vue in that category).

Usually the thinking was, while it may not make sense, it will someday when my project grows, so let's adopt it right away. And for years I would have said that was a decent advice. Nowadays I think that with some of the more extreme scales behind some of those trends though, it's not always as clear cut.

dmitriid 2021-08-17 11:38:59 +0000 UTC [ - ]

Separation only works for so-called leaf components: buttons, links, tabs etc. that can actually be reused.

And even then you will definitely run into issues such as "in this particular case this particular tab will look like this".

While the web was mostly leaf components (text, articles, images, links) this separation kinda worked. The moment you move into app territory, there are not that many things that are reusable and benefit from separation, because your UI is directly dependent on business logic and vice versa. And because every screen in your app is a unique view into a unique part of your functionality.

dtagames 2021-08-17 15:01:54 +0000 UTC [ - ]

Very true. Even in "leaf" components (I'd never heard them called that. Cool.), the actual appearance is often dependent on some state that only the parent knows. Is the button highlighted or dimmed? Blue or red? Well, the button component doesn't know. (It shouldn't). But the parent who spawned it must know and pass that information into the button by a param.

This should, ideally, be as short and sweet as possible. In reality, like you say, the two ideas (visual + biz logic) will always be married in any non-trival application.

dmitriid 2021-08-17 16:06:15 +0000 UTC [ - ]

leaf components as a term appears in various discussions on web components. Many people don't see the value in full-blown web components(as they have lots and lots of unsolved issues), but agree that they may fill the niche/need for "dumb" reusable components at the end of the DOM tree (hence, leaf :) ): date pickers, buttons, links, all that kind of stuff.

dtagames 2021-08-17 16:16:06 +0000 UTC [ - ]

I've seen tons of libraries of these and every big company seems to make their own, then try to release it to "help others." It's a noble idea, but the reality is that most of the cruft in those component sets won't be useful to app developers who aren't making apps for that company.

In other words, you are likely to need too many customizations even to leaf components to be able to use someone else's.

Aeolun 2021-08-17 11:39:02 +0000 UTC [ - ]

I think eventually everyone just realized that so much of the styling is dependent on the element hierarchy that makes up the page that it’s pointless (and indeed painful) to separate your HTML from the component that uses it.

If you are actually using components, that isn’t much of an issue.

In a time when you’d be returning a whole document every single time, it might make sense to say ‘style this one document with this one stylesheet’, and even more so in a time when HTMl was still more or less semantic (e.g. an actual document).

presentation 2021-08-17 15:35:22 +0000 UTC [ - ]

This! Usually CSS doesn't even make sense outside the context of the page/component it's styling.

There's also some nice stuff with modern tooling, where CSS is global by nature but writing it with your JS allows for the platform to automatically namespace your CSS, making styling behavior much more consistent.

Separately it also often makes sense to style things not just based on the HTML produced but also based on data stored in JS; writing your CSS with your components allows for a greater level of dynamic styles (which, to be fair, if you can achieve with pure static CSS is preferable, but it's not always the case).

jt2190 2021-08-17 13:01:38 +0000 UTC [ - ]

> ... [W]hy [are] a lot of new web languages/frameworks are mixing logic and content in the same file again...?

In olden days, the DOM was treated like something shared. This could lead to a single DOM elements receiving changes from all over the place: Multiple CSS selectors would include it and apply style rules, and multiple JavaScript scripts might select and manipulate it. Spitting the CSS/HTML/JavaScript into multiple files just makes it harder to know what's doing what.

The new frameworks are built around the idea that when we need to manipulate or style a DOM element then it should be isolated from the rest of the DOM, and so should the CSS and JavaScript that do the manipulating. In other words, what we often call "components".

For convenience, we often group these three things into the same file, or into small files sharing the same directory.

Reasoning about them much simpler, because each one is like a tiny HTML document with just a few DOM elements. No need to review hundreds of CSS selectors or JavaScript event handlers, because everything is together in one small package.

TekMol 2021-08-17 13:15:26 +0000 UTC [ - ]

If you isolate the DOM elements from each other, then how do they share common styles? You certainly do not want to define the font type for each DOM element individually, do you?

dtagames 2021-08-17 14:33:10 +0000 UTC [ - ]

Lit (which evolved out of Google's Polymer project) has many of the same goals of the Imba project and tries to reduce the spaghetti of something like AngularJS.

It handles CSS by letting you define it in within an individual component (file) but also import a style from another file. That way, your shared styles are in one place and only the overrides or extra styles needed for a special component are in its file.

I think it's wonderful!

Not to denigrate this project in any way, but most or all of its goals are already met by Lit[0]. Instead of a new language, it uses regular TS and regular CSS.

[0] http://lit.dev

dalmo3 2021-08-17 14:00:20 +0000 UTC [ - ]

The development is isolated, but the components are still placed somewhere in the dom, so regular hierarchy/specificity rules apply.

Granted, some UI frameworks do add a lot of redundant code to maximise component independence, then offer JS-based or class-based theming to keep development DRY.

k__ 2021-08-17 11:09:36 +0000 UTC [ - ]

A feature usually consists of all three HTML/CSS/JS.

So, if you split by technology, you don't have the code belonging to one feature in one place.

ssijak 2021-08-17 13:16:04 +0000 UTC [ - ]

This is the most correct answer. It also felt wrong to me when I first started doing serious frontend development (I started it with AngularJS), but than it all made so much sense after a few projects and after I _experienced_ the benefites.

politelemon 2021-08-17 17:46:56 +0000 UTC [ - ]

But even then, a feature can end up spanning multiple files for reusability.

jshmrsn 2021-08-17 11:14:06 +0000 UTC [ - ]

For web apps, you often want your content/HTML to dynamically render different elements depending on application state. Using a separate template file and having your logic plug into the template is often more complicated than just having your flow logic (if/else chains checking application state) return bits of relevant HTML/content inline.

namelosw 2021-08-17 17:30:50 +0000 UTC [ - ]

A bad metaphor I just came up with: You're cutting a birthday cake. If you do the horizontal cuts you could at best have like 4 cuts and it's very hard. If you do the vertical cuts you could easily have like 16 cuts for everyone.

Because the horizontal way separates the concern the wrong way, or more precisely, the non-scalable way.

The idea is the same way that backend architectures are migrating from layered architectures to microservice or DDD alike architectures.

HTML, CSS, JavaScript separation of concern: 3 layers. Layered architectures: presentation, application, domain, infrastructure etc. There's only O(1) number of layers, so it's not scalable enough for modern applications. You can came up with more layers, but it's still O(1) and would be more strechy, despite the business and codespace are growing fast. People will struggle because everytime they change one layer, they have to find the corresponding other layers of code - it starts to defeat the purpose of separation where it should help people not caring other layers when modifying code.

A more critical separation of concern is to have O(n) separation: you can different domains like products, inventory, sellers, account managment, custommer support etc. If your business continue to grow, you could have more of them. And more importantly, it's much easier to separate teams into pizza-sized teams than layered separation.

Don't get me wrong, layered architectures are still useful. In fact, most of the DDD implementations are layered. But there's mental overhead when you introduce separation. Communities like React and Vue decide that it makes sense to merge layers in Front-end for local reasoning over separation, and accoding to my experience it works well (because I find it's very common to modify HTML, JavaScript, and CSS at the same time before I even started to use React).

tenaciousDaniel 2021-08-17 12:04:21 +0000 UTC [ - ]

Hard to describe, but it feels like it makes much, much more sense. I think it's because the divide between html/css/js is supposed to be one of concerns, but in reality the concerns are interwoven in many ways, and leads to issues when using them at scale. None of the scaling issues I've faced in the past re-occurred when I used a framework that combined the languages into single files.

ehnto 2021-08-17 15:29:38 +0000 UTC [ - ]

As others have mentioned, it's being used when writing components. Why does it work so well for components though, since you could just as well still separate the CSS? I think it's because of code co-location. Everything that describes how a component looks and functions lives in one file only. That's also why inline styles and utility libraries are palatable now, it's easier to reason about if it's described directly on the element, and you don't need to remember to update all usages of the inline style since it's a re-used component. It's even one step less indirection than using class names in that context, which is handy.

I also think most people are quite bad at organizing CSS, so I'm personally thankful for this change even though I love a well organized simple CSS/HTML site. It means less projects I inherit are rabbit warrens of legacy CSS to unravel.

q-rews 2021-08-17 11:11:15 +0000 UTC [ - ]

The distinction makes sense on documents but it starts to break on apps. Javascript depends on HTML and HTML is generated by JS.

dtagames 2021-08-17 15:04:50 +0000 UTC [ - ]

Your concept is right but that wording isn't quite right. JS runs fine without HTML and thousands of lines in any web app don't even touch HTML. Node is HTML-free, for example. Also, of course, HTML, can be generated in a thousand ways and has no dependencies on JS.

I think what you were going for is the idea that, beyond a trivial application, the visual appearance stuff is always going to be tied to some app logic or business logic or state or whatever word we want to use.

And that's very true regardless of what framework or language we choose.

q-rews 2021-08-17 19:49:54 +0000 UTC [ - ]

You read that out of context. We’re talking about apps, web apps, SPAs, and specifically situations that bring you to mix HTML and CSS into a JavaScript module.

That situation most likely requires HTML (DOM) generation in the browser, which can only happen in JavaScript.

So, I reiterate, the HTML is generated by JS in these interactive modules.

You could generate the HTML on the server and then use jQuery to toggle elements… or just create full-JS components that take care of everything, giving some input data, instead of separating the HTML from the JS.

void_mint 2021-08-17 17:44:22 +0000 UTC [ - ]

> The distinction between HTML, JS and CSS

When all three of these things have to care very directly about eachother, separating them makes less sense.

bjourne 2021-08-17 17:17:49 +0000 UTC [ - ]

It never made a lot of sense in practice. Designers couldn't maintain CSS files because the language was too complicated for most. And these days, most DOMs in dynamic web pages are generated by the JS so the HTML/JS separation doesn't make sense either. Separating content, presentation, and logic is a good idea in theory, in practice not so much.

ourcat 2021-08-17 12:55:23 +0000 UTC [ - ]

This is exactly why I prefer Angular to React.

Our designer wouldn't have been able to deal with HTML markup within the JS files in React. Having the HTML and (S)CSS separated out made life much easier for him in Angular.

(edit: Naturally downvoted due to being slightly critical of React on HN. Which happens every time.)

randomdata 2021-08-17 17:54:55 +0000 UTC [ - ]

I'm not sure you are being critical of React. There is nothing about React that prevents you from separating the HTML and CSS into separate files.

You are being critical of separation choices. To which I am curious why embedding the CSS and HTML inside a Javascript file makes any difference to the designer? In practice, we often see slightly different syntax to accommodate, but I cannot imagine that is a true barrier. The CSS and HTML (or their slightly modified equivalents) are still logically separated from the rest of the logic in the file.

ourcat 2021-08-17 18:19:10 +0000 UTC [ - ]

I build all the components and get them working with mostly 'vanilla' styling. Then he brands/styles any he needs to by simply editing the .html and .scss files.

He has no idea about how the TypeScript/JavaScript files work. He doesn't really have to touch them, unless to maybe see what extra data the component model contains if he wanted to dig deeper and display other things.

randomdata 2021-08-17 19:29:08 +0000 UTC [ - ]

Does he need to know how the Javascript files work, though? The HTML/CSS parts are still logically separated from the rest of the code. I am not sure someone who is capable of working on that type of content would struggle to recognize them. As long as the team is consistent, you can even reasonably predict exactly where such content would be found in the file.

If the designer was handed an HTML page with <style> tags embedded, I cannot imagine he would fall down unable to figure out where the CSS is, and this is not much different.

qorrect 2021-08-17 15:34:26 +0000 UTC [ - ]

React is garbage I have no idea why it took off. Angular all day e'ry day.

Shorel 2021-08-17 17:47:37 +0000 UTC [ - ]

CSS "separation of concerns" never worked well anyway:

https://adamwathan.me/css-utility-classes-and-separation-of-...

notJim 2021-08-17 21:00:21 +0000 UTC [ - ]

Some of the early React talks from 2013 give great answers to this question IMO https://www.youtube.com/watch?v=x7cQ3mrcKaY

hyldmo 2021-08-17 17:32:04 +0000 UTC [ - ]

Another way too look at it: Do you prefer backend, frontend, and databases to be separate teams, or should each team have ownership over their own backend, frontend, and db?

savmat 2021-08-17 12:33:16 +0000 UTC [ - ]

I’m sick of programming languages that use “fast typing” and “productiveness” as a selling point. There’s no selling point in being productive doing a counter in a few seconds, production scenarios are far more complex and very often all those new programming languages fall short to their promise. Btw I don’t want to be fast or productive, I want to write code that works decently and is great for other humans myself included

methyl 2021-08-17 12:52:23 +0000 UTC [ - ]

It depends. If your work is to create a new counter app every day to support some specific, single usecase, in other words you write a lot of simple apps and not a single complex one, then it’s definitely a win for productivity.

nsonha 2021-08-17 14:13:08 +0000 UTC [ - ]

> create a new counter app every day to support some specific, single usecase

sounds like the kind of thing that programming was invented to eliminate

RussianCow 2021-08-17 20:37:18 +0000 UTC [ - ]

Who actually does this for a living? And where do I sign up? :D

In all seriousness, I've never worked at a company that did anything like this. What is the use case for creating lots of small apps as opposed to maintaining a larger product?

omniscient_oce 2021-08-18 05:09:32 +0000 UTC [ - ]

Another marketing pet peeve that I have is term "blazing" fast. I think it's so overused now on any new tool's landing page posted online that I instantly just assume that it is, in fact, of relatively average speed. Are there no other synonyms for fast these days?

lhorie 2021-08-17 16:27:06 +0000 UTC [ - ]

That's not really a complaint about languages so much as it a complaint about marketing though, is it?

I don't go learning every language to mastery level, but I try to at least keep track of whereabouts they lie in the spectrum so I can cut through marketing-speak when I see it.

The way I see it, if a thing is being dogfooded in production, it's production grade. People can debate go-vs-rust or whatever till they're blue but the reality is simply that you can ship something with either and there are always going to be proponents and detractors for each side.

While I haven't followed Imba that closely, I've been aware of it for years, and I have to say it's one of few projects that actually has interesting technical takes on several fronts.

turtlebits 2021-08-17 16:31:03 +0000 UTC [ - ]

Considering Javascript is the only language supported on the frontend, claiming to be more productive is definitely valid.

Coffeescript was a breath of fresh air compared to writing ES5.

cflewis 2021-08-17 16:52:58 +0000 UTC [ - ]

I sure am tired of Javascript being the lingua franca of the web. Imagine if we decided C was good enough and now all programming languages from that point on should just be something that cross-compiles to it.

mprovost 2021-08-17 17:34:19 +0000 UTC [ - ]

Isn't that what WebAssembly is for? It's kind of the web version of C pretending that everything is a PDP-11.

void_mint 2021-08-17 17:41:08 +0000 UTC [ - ]

Support WASM then?

arcanon 2021-08-17 16:45:14 +0000 UTC [ - ]

We need a Coffeescript Renaissance!

scotty79 2021-08-17 21:33:38 +0000 UTC [ - ]

World needs a version of coffeescript that compiles to typescript.

phil294 2021-08-18 11:54:36 +0000 UTC [ - ]

phil294 2021-08-17 17:32:04 +0000 UTC [ - ]

Nothing is holding you back from using it!

nsonha 2021-08-17 21:18:56 +0000 UTC [ - ]

lack of types and it used to be ignorant of perf in the generated code (creating IIFE unnecessarily)

phil294 2021-08-17 22:19:51 +0000 UTC [ - ]

Regarding types, you're right, though JSDoc can get you very far

Regarding perf (performance, I guess?) - are you speaking of the single, global one? As CS takes care of variable scoping automatically, I think it makes a lot of sense (and is deactivatable anyway)

nsonha 2021-08-18 06:39:14 +0000 UTC [ - ]

> JSDoc can get you very far

in the sense that you write them and parse them in your brain manually. JSDoc is useful to me because IDE supports it for javascript. Without IDE support it's just a bunch of fancy comments

phil294 2021-08-18 09:01:59 +0000 UTC [ - ]

You could try using the https://github.com/phil294/coffeesense/ VSCode extension for that, released 7 days ago (disclaimer: I made it).

nsonha 2021-08-18 13:14:16 +0000 UTC [ - ]

Thanks, this looks really useful

nsonha 2021-08-18 00:48:41 +0000 UTC [ - ]

no coffeescript desugars into functions things like switch statements, do statements and some other things (that have nothing to do with functions)

arcanon 2021-08-18 04:17:54 +0000 UTC [ - ]

Just tried a switch statement, didnt desugar into functions. Maybe you haven’t been keeping up with the latest.

Mikeb85 2021-08-17 19:02:48 +0000 UTC [ - ]

Then don't use it. Some of us do like productive (ie. expressive and batteries included) languages. PHP, Python, JavaScript and Ruby still power most websites. There's plenty of choices for enterprise languages and frameworks if you want.

Productive, everything included languages/frameworks such as this are great for freelancers, designers, students, and anyone who wants to get up and running quickly. You can also still create maintainable projects with expressive languages (Google and Python, GitHub and Ruby are a couple examples).

People are doing things that don't break with 'productive' languages.

laserpistus 2021-08-17 13:04:55 +0000 UTC [ - ]

Fair enough - and so you skip the languages that doesn't fit that bill for you and pick one that you feel bring you those outcomes. No hurt feelings!

k__ 2021-08-17 13:56:29 +0000 UTC [ - ]

I don't see the value in being able to "type fast".

I see it in less visual clutter.

arcanon 2021-08-17 21:28:08 +0000 UTC [ - ]

Yes. Which gives you more control over how you make the code look. DSLs.

lowercased 2021-08-17 13:33:09 +0000 UTC [ - ]

You could be doing stuff that works decently, is great for humans, and still be productive (maybe even fast). Or figure out how to do it faster next time.

Someone else may want you to be fast and productive. Or... they'll find someone else who can provide what they want who is faster and more productive than you.

jl2718 2021-08-17 13:25:05 +0000 UTC [ - ]

I read this and still have no idea what the ‘memoized DOM’ is. There is a broken link to ‘how it really works’. Apparently there is a huge speed-up over react. I don’t actually care about this; I’d rather know what the slow parts of browser DOM changes are, and how it gets around them.

Forgive my ignorance if I’m missing something obvious; I am completely new to JavaScript, but so far have found react/vue/etc confusing, outdated, and unnecessary for my performance needs, versus going raw with the latest features. It sounds like I might be missing something that could hurt me down the line. Thanks.

lhorie 2021-08-17 15:26:01 +0000 UTC [ - ]

(Disclaimer: I'm the author of Mithril.js)

I looked at this a few years ago and IIRC, it refers to a very specific optimization for recycling DOM nodes in very specific cases. Recycling basically just means reusing pre-existing DOM subtrees instead of naively creating new ones. To my knowledge, Inferno.js and Mithril.js implemented a similar optimization but eventually dropped it because it was difficult to compute when the optimization could be applied and it wasn't worth the complexity (when using virtual dom anyways; my understanding is that imba doesn't do virtual dom)

I recall Imba always had quite nice perf numbers. Recycling DOM nodes did indeed give huge performance increases in synthetic proofs of concepts I did for Mithril.js. A good real world example where it's supposed to shine is tabular data: typically you'd key your rows to get good array diff performance, but this means paginating recreates the entire table from scratch every time. Recycling means reusing the existing DOM instead of re-incurring document.createElement call overheads for the entire table. Of course, in practice it's quite a bit more difficult to deal with edge cases (e.g. DOM state such as element focus)

The two things that I thought were problematic with Imba were a) lack of typing (which has since been addressed) and b) compiled output readability (i.e. it looks nothing like source code). It looks very nice otherwise, and it has come a long way since 7 years ago.

moron4hire 2021-08-17 13:52:47 +0000 UTC [ - ]

I learned React to know what it was about and what people were talking about. I think a lot of people get the wrong idea about React. They say the virtual DOM is the most important feature, but I think it's actually the fact that it forces you to componentize your code. And it does this by making non-componentized code very painful to work with, so you have to componentize to be able to have any shot at getting React to work.

But if you already have the componentization mindset, I don't think React really adds anything. As you have said, managing raw DOM operations can be significantly faster. And because you have componentized your code, they are significantly easier to reason about.

The only problem is that working with a medium-sized smash of code is not as painful in vanilla JS as it is in React. So if you've grown your application over time, adding bits and bobs to it piecemeal, you're likely to end up with an application structure that is inherently difficult to manage. Then folks rewrite in React, get forced to componentize, and lo-and-behold, everything is much easier to manage.

At this point, whatever gets you there, gets you there, I guess. Personally, I make VR applications that run in the browser, so I coveteth performance.

danenania 2021-08-17 17:23:24 +0000 UTC [ - ]

Modularity or componentization as you call it (I like that! :P) is definitely one of React's main advantages. But I'd say just as important is that it acts as a trojan horse, essentially, to get people using the "good parts" of functional programming without having to understand FP deeply.

Just like React encourages components, it also encourages immutable data, one-way data flow, functional reactivity, and thinking in terms of state machines, even if you aren't necessarily familiar with that terminology.

All this stuff makes building a complex UI far more manageable and helps to avoid common pitfalls.

dragonwriter 2021-08-19 02:30:00 +0000 UTC [ - ]

> They say the virtual DOM is the most important feature

Who says that now? I mean, in recent years VDOM seems to be more often criticized as the problem (with performance, but also otherwise) with React, even by people who like its basic dev-facing structure. Which is why you see frameworks with JSX and React-like structure (even Hooks, but without the explicit dependency pain point in the case of Solidjs) whose key selling point is no VDOM.

beebeepka 2021-08-17 20:17:48 +0000 UTC [ - ]

"I know almost nothing about the subject at hand, so here's my expert opinion on it"

moron4hire 2021-08-17 20:45:00 +0000 UTC [ - ]

I've been a software developer for 20 years. I've been doing JavaScript since it was invented. I do actually know a lot about these things.

jl2718 2021-08-19 02:20:04 +0000 UTC [ - ]

Confession: when I say “completely new to JavaScript”, I mean that I once used it to make badly-animated pages as a kid in the 90s. It’s completely different now, so I say I’m a complete beginner.

beebeepka 2021-08-18 15:12:51 +0000 UTC [ - ]

That's not what you said initially. Nice bait

moron4hire 2021-08-18 15:32:50 +0000 UTC [ - ]

I didn't say anything about my past experience. Is it so incomprehensible that people did massive amounts of web development before React was even a twinkle in someone's eye? Is it so incomprehensible that someone could learn React and then choose not to continue to use it?

beebeepka 2021-08-18 18:32:13 +0000 UTC [ - ]

I actually don't like react. The whole thing reeks of religion.

I do like Vue and Svelte, though. They let me do powerful things without getting in the way.

Native APIs are fine but eventually you're gonna need some more abstractions in order to scale beyond a garage app.

Frankly, I tend to write my own stuff on the backend but there's so much more work on the front end, you end up either adopting or building a framework.

jl2718 2021-08-17 14:08:39 +0000 UTC [ - ]

I like the components. I do not like having to do everything through a JSX template. I do not like debugging through a transpiler. I do not like testing a DOM tree I didn’t build.

Just my novice view.

sebular 2021-08-17 14:56:46 +0000 UTC [ - ]

You're going to struggle as a novice if you're quick to form opinions about things that you don't fully understand, especially if those opinions involve rejecting wildly popular tools used by people with far more expertise than you have.

People who understand React/Vue/Angular are free to criticize them (and have many valid reasons for doing so), but when you do it after following a beginner tutorial or two, you're just being ignorant.

How do I know this? Because you're criticizing React for forcing you to "do everything through a JSX template" and "debugging through a transpiler", which tells me that you aren't aware that React can be used without JSX and without any transpiling.

Since that information is available to you on about the fourth paragraph of the "Getting Started" page on reactjs.org, you clearly haven't bothered to learn much about it at all.

RussianCow 2021-08-17 21:57:18 +0000 UTC [ - ]

> I do not like testing a DOM tree I didn’t build.

What does this mean?

49531 2021-08-17 13:55:12 +0000 UTC [ - ]

Most frontend frameworks are not created to solve performance of vanilla web applications, but rather to make engineering larger and complex applications easier.

sidlls 2021-08-17 14:02:06 +0000 UTC [ - ]

Your comment reminds of the Facebook blog complaining that Apple couldn't handle their app's scale, and that's why it was so slow.

Most "larger and complex [frontend/client] applications" don't need to be as large and complex. By "most" I mean "almost all." In fact, I can't think of a single web application or mobile app I've used that can justify all the terribly complex garbage that goes into many of them.

lyaa 2021-08-17 18:40:49 +0000 UTC [ - ]

The complexity of many applications does not come from the client-facing features but rather from other business requirements.

For example, interaction analytics, A/B testing support, targeted updates, predictive caching, obfuscation and security, etc. For large companies, setting up the code base so new junior employees can start making contributions fast is also important and that adds to the total complexity too.

It's so much simpler to build an app if all you needed to do is get the minimum features done.

sidlls 2021-08-17 19:39:34 +0000 UTC [ - ]

Yeah, not really. I've worked at some big companies, and currently at one you almost certainly have heard about in the news. The features you describe don't justify the complexity of these apps. Usually these features are implemented without any real consideration for the overall architecture, independently, and within a bubble such that the engineers and PMs on the project locally maximize the feature's complexity. Then it cascades when the feature is integrated into the rest of the app.

lyaa 2021-08-17 21:52:39 +0000 UTC [ - ]

I think we differ in what we consider "justification." It seems to me that you are using the moral judgement of the sacrifice of perfect-pretty-code while I am considering the business-operations evaluation.

For a company which needs teams to implement features independently, the bubble you judge to be negative could indeed be an acceptable, or even necessary, compromise. The business decision to have independent teams might introduce complexity, sure, but within the context of the company's needs and goals, it might be a good choice and thus the added complexity is justified in my view.

The goal of any company is not to generate the most optimized code base. It only needs code that works for its purposes. It's a necessary balance which carries risks and opportunities.

sidlls 2021-08-18 02:05:32 +0000 UTC [ - ]

I don't disagree with your last paragraph. I think we just disagree on where that line is reasonably drawn.

jsf01 2021-08-17 12:40:06 +0000 UTC [ - ]

Really interesting project! I will definitely be trying it out today. One question—although you criticize some of the more common vdom benchmarks, I think it is still valuable to see where the dom updating strengths and weaknesses are in various approaches. Have you run any of the more standard frontend benchmarks on this and compared? I think it would be cool to see an entry for imba in the js-framework-benchmark table, especially considering your claim of low memory footprint.

https://github.com/krausest/js-framework-benchmark

Great work so far, I’m excited to give imba a spin.

somebee 2021-08-17 12:42:01 +0000 UTC [ - ]

I will try to add v2 to that benchmark relatively soon - it is a lot faster than v1 and has a much lower memory footprint and faster initial load time :) Should probably combine it with a few pull requests to the benchmark itself - as I consider it pretty flawed (see another comment here).

archibaldJ 2021-08-17 10:42:40 +0000 UTC [ - ]

That's a very tight integration with JS&TS! Are you compiling into TS and then to JS? Or is it more of a decoupled process that was set up for the type-checking (like how tsconfig and babel works together)? When I was trying out ReasonML a few years back (and being unfamiliar with OCaml) I ran into some problems with bridging across types.

I checked out https://github.com/imba/typescript-imba-plugin for a bit and I'm still quite lost. Love to learn more!

Also, what is the cross-file refactorings in the tooling? Thanks!

somebee 2021-08-17 11:54:16 +0000 UTC [ - ]

Yeah, the typescript-imba-plugin does quite a lot of magic and might be a little rough to get into.

We essentially do the type-checking by compiling the files to js with jsdoc annotations, and for some features we also generate `.d.ts` files (see https://dev.to/somebee/global-type-augmentations-with-automa...). There is still a lot of work to be done on the integration. There are bugs and missing featyres, and the type-checking only happens in the tooling atm. The compiler could not care less about your types.

Since it is developed as a ts language plugin, references to imba files (like goto definition etc) works from ts/js files (you can include imba files in js/ts), and renaming methods / files works across all ts/js/imba files in your project.

soheil 2021-08-17 14:30:09 +0000 UTC [ - ]

This read like gibberish to me

  <header[fs:xl fw:700 ta:center c:gray8/40 p:2]> name
Why are we moving away from elegant legible HTML/JS/CSS stack to no nightmares like this and React where everything is smooshed together?

> bringing the elegance and concision of Ruby into the browser

As a big fan of Ruby how does this tap into the elegance of Ruby? Ruby is readable, this is not. In Ruby it's very difficult to write code that makes people suffer greatly to understand, this seems to be the opposite.

> It is very opinionated, so some of you might not like it

As if that's the reason people won't like this. Give me a non-opinionated language and I'll show you as many people not liking it. Create a good language and people will flock.

geenat 2021-08-17 17:46:08 +0000 UTC [ - ]

Thought this at first but it's just tailwind css aliases. They are interchangeable with the full name.

fs = font-size

fw = font-width

ta = text-align

c = color

nsonha 2021-08-17 21:29:04 +0000 UTC [ - ]

> Create a good language and people will flock.

What a truthfully useless statement. "Good" means having opinions about things that dont matter? Like "I don't like that css uses full words, I prefer these acronyms"

Who gives a shit? Is this language designed to prevent copy pasting? You may be on to something here.

soheil 2021-08-17 21:48:56 +0000 UTC [ - ]

No that's not what good is, I in fact love languages with concise syntax, Java is probably the worst in that department.

hakube 2021-08-18 04:05:26 +0000 UTC [ - ]

Really? Java has the best syntax out there. It's consistent and very easy to read unlike Go, Rust or the modern languages these days

dragonwriter 2021-08-18 04:11:55 +0000 UTC [ - ]

> Java has the best syntax out there

De gustibus non est disputandum

> It's consistent and very easy to read unlike Go, Rust or the modern languages these days

Eh, its Algol-style syntax with a bunch of unique flourishes, like...lots of popular languages. Its nothing special, but its not especially consistent.

If your experience is heavily in Java, then it is probably particularly consistent (with your experience) and readable to you, but it doesn't seem to have any features that make it more of either of those than most popular languages in any general, not-experience-dependent, sense.

nsonha 2021-08-18 06:13:12 +0000 UTC [ - ]

Go is like java minus semicolons and classes. I'd say the syntax is the almost the same but go's semantics are more simplified.

I dont think there is anything special about java syntax but agree that it's simple and consistent. Java used to not have "var" and looked really dumb by having type and constructer to be the same duplicated thing, but other than that what I hate about it was mostly java beans and accessors. The problem was the idioms, not the syntax.

nsonha 2021-08-18 00:45:18 +0000 UTC [ - ]

yeah who doesn't, except you don't have to make a "better" language with concise syntax but mediocre in everything else (exact same semantic as javascript, we already have python for that). Make a lisp or a haskell.

And this garbage css syntax is not concise, it's stupid, it's concise in the same sense that emoji is concise comparing to English.

armchairhacker 2021-08-17 18:37:02 +0000 UTC [ - ]

Usually I think trying to make your own language for anything more than a DSL is a bad idea. But this project looks very impressive.

I've never heard of Imba before this post and haven't seen any real-world projects (besides Scrimba). If this is as good as it looks we'll probably get some soon.

Reminds me of Elm which took a similar route and seems to be successful.

As someone else said, one thing you probably want is static typing. Also make sure your language works well on larger projects. Everyone thinks they're making a simple website, but then it scales.

brundolf 2021-08-17 19:28:02 +0000 UTC [ - ]

> Usually I think trying to make your own language for anything more than a DSL is a bad idea.

Depends what "your own" means. If it's a one-off language just for one specific project, then you're right. But this one is much more than that. Surely you don't think people should stop making new languages entirely?

armchairhacker 2021-08-17 20:02:56 +0000 UTC [ - ]

No i mean that a single person or small group can’t make a general-purpose language that would beat TS, Rust, Java, Swift, Go, etc.

All these languages are supported by huge groups. They have hyper-optimized compilers or JIT, IDE integration, libraries, and adoption.

If you can form a huge group, then you can beat these languages. Or if you target a niche. Or if you can use existing tooling (transpiling, LSP, effective existing libraries), and spend a lot of time and effort. Imba seems to be taking the third approach.

Tucanix 2021-08-18 03:45:04 +0000 UTC [ - ]

This is just a clone of Svelte? It even has one of the same examples.. and similar syntax.

Better productivity is nice, but putting an abstracting in the way could be worse because it hides stuff from you you would otherwise learn or even make better yourself, this is also how we get slow apps which web based applications are infamous for. We need more native apps and new areas to explore not more of the same billion JavaScript libraries etc. JavaScript is brain rot for programmers and places creative people in tiny bloated slow sandboxes where they create carbon copies of each other. I hope someone finds it useful, i don't mean to rag on about this particular project.

jazzyjackson 2021-08-17 10:33:57 +0000 UTC [ - ]

I am glad you persevered. I’ve been working on a language for 3 years now and sometimes I lose faith. It’s good to know that sometimes, projects can be finished (or at least shipped ;)

sfusato 2021-08-19 13:31:49 +0000 UTC [ - ]

What's the story about payload/bundle size for the compiled JS? imba.io stands at 3.76MB & scrimba.com at 2.15MB

rawoke083600 2021-08-18 07:26:11 +0000 UTC [ - ]

Looks really good ! Well done ! One "warning" I might give is I see "imba.commit" can become a problem.

This reminds me of the AngularJS(1) days, where if something didn't work (update), you will add a few well placed $apply or $digest everywhere. And of course if it doesn't work, you throw that $apply & $digest calls in s "setTimeoutLoops"... it got ugly fast.

This was of course was not the "correct way" of doing it in a "well written application" but many programmers working on one codebase, eventually somewhere someone gets frustrated with their code not working and in 12 months, you have these little "performance suckers" all around your code.

I don't really have a solution, maybe make it more "robust" or just keep in mind, programmers of all skill level and frustration levels, might just litter the codebase with these "magic-might-fix-my-issue-calls"

Congrats again on Imba !I do really like it :)

yewenjie 2021-08-17 11:56:38 +0000 UTC [ - ]

Quick question - how does the memoized DOM compare with no-virtual-dom-at-all approach of something like Svelte?

lowercased 2021-08-17 12:18:24 +0000 UTC [ - ]

https://krausest.github.io/js-framework-benchmark/2020/table...

This lets you choose from multiple frameworks - comparing svelte against a few react variations, what I saw was that svelte was always fastest, but usually by a factor less than 2 (any react was 1.x times slower than the svelte).

The imba vs react numbers (from the article at https://www.freecodecamp.org/news/the-virtual-dom-is-slow-me...) shows a 30-40x speed difference.

lhorie 2021-08-17 16:06:33 +0000 UTC [ - ]

I have to echo somebee about that benchmark suite. It's fairly well known in the framework-bulding community that this is not a very good benchmark (just ask Boris Kaul of Ivy.js, Ryan Carniato of Solid.js, Leon Sorokin of domvm, etc etc).

Some "frameworks" achieve good numbers there by being utterly unusable in real life, others miss the spirit of the benchmark completely (e.g. submitting a non-keyed implementation as keyed thereby gaining an unfair/misleading advantage), and as somebee said, the benchmark itself largely measures repaint time (and does so in a less than ideal way, by using setTimeout macro queue as a proxy for repaint time measurement, in band, instead of instrumenting performance via CDP). It lacks rigor in many ways (the most blatant was that initially it considered keyed and non-keyed implementations on par, but there are other issues such as putting a lot of weight into DOM creation compared to e.g. array diff, or as somebee said, not measuring low repaint load diffs)

IMHO, it only has two things going for it: a) it has a lot of frameworks listed b) it does at least attempt to measure repaint times unlike other benchmarks that only measure JS time (which has become somewhat irrelevant since V8 et al now offload repaints out of the JS thread)

somebee 2021-08-17 12:24:54 +0000 UTC [ - ]

Tbh, I think the js-framework-benchmark is flawed. It mostly tests the performance of the browser. I should write a whole blog post about this. Just as an example, all the table benchmarks uses a table with non-fixed width, which results in a full repaint AND layout of the whole table+page whenever a cell changes. If you change the table to a fixed width (as all real tables are) the relative difference between the frameworks increase by a factor of 5 or more.

And when you benchmark the speed of creating 10000 dom elements in an instant, less than 5% of the time should really be spent inside the framework one is supposed to test.

I stand by my claim in the mentioned article that tiny changes to a larger dom tree is a far better indicator of real world performance than anything else. Here Imba is really orders of magnitudes faster than react.

The last time I tested it, Imba was more than 10x faster than Svelte as well, but I'm not proficient enough in Svelte to claim that as a fact, and I have tremendous respect for Rich Harris and everything he's done with Svelte and other libraries.

dumindaxsb 2021-08-19 05:54:59 +0000 UTC [ - ]

This is a cool project somebee. Interested to explore more.

On benchmarking: I went through the same concerns and ended up building a little benchmarking tool for a simple reactive UI library I'm working on. It's not super user-friendly yet but doing a good job of profiling tasks.

You can write custom benchmarks by clearly separating pre-setup work than relying on ready-made benchmarks (a bit of a pain initially, but helps a lot to fine-tune at unit-level going forward).

It uses Chrome DevTools Protocol(CDP) through Puppeteer and allows to analyze execution durations separately (Scripting, Layout, Paint, etc). Plus, it saves raw JSON profiling data, so you could import & examine it visually on DevTools Performance Tab's Timeline.

Think it will be helpful: https://github.com/dumijay/pfreak This is how the results look like: https://caldom.org/benchmark/

codesections 2021-08-17 14:05:28 +0000 UTC [ - ]

Setting aside performance comparisons, how does Imba's approach compare to Svelte's from a design perspective? From your Meet the Memoized DOM article, I take it that Imba is basically converting declarative code into imperative code that mutates the DOM – on first glance, that sounds very similar to Svelte's compiler-driven approach.

Are the two strategies as similar as they sound, or am I misunderstanding something?

lowercased 2021-08-17 12:37:10 +0000 UTC [ - ]

Flawed in what sense? I don't doubt that there are some conceptual drawbacks, and this only benchmarked chrome, not other browsers. I do think there's some utility in relative comparisons that have a standard/fixed baseline, as it would still seem to show what overhead a framework/library brings to the table.

FWIW, my initial impression of imba is that it's very impressive. I do think you rightly point out that, at this point, it may still be hard to leave larger ecosystems of react/vue/etc. DOM/UI speed of the project's JS toolkit generally has not been any meaningful impact in the projects I've worked on in the last several years - the data size and audience and app space just don't really call for it. However... as my needs change, imba will be something I'll revisit. Thank you.

2021-08-17 13:57:55 +0000 UTC [ - ]

cxr 2021-08-17 14:17:05 +0000 UTC [ - ]

> DOM/UI speed of the project's JS toolkit generally has not been any meaningful impact in the projects I've worked on in the last several years

Maybe you're the exception among your peers or something, but I'd wager you're wrong. Benchmark or no benchmark, imba.io and the site for Scrimba are way snappy. In contrast, when I find myself having to derp around on a landing page or a UI made with React or contemporary frameworks, I can feel the bloat. Is it possible that being elbow deep in this stuff has dulled your senses?

lowercased 2021-08-17 15:12:54 +0000 UTC [ - ]

Not sure how you got from this that I was saying that there's no different between react and imba, or that it's not snappy/fast.

I was just saying that for the majority of LOB apps I'm working on, whether a table of 2000 entries renders in .2 seconds or .3 seconds has no meaningful impact on the client projects I'm working on. Even though it's a 50% slowdown, or 33% speed up, depending on how you measure, that speed difference has no impact on these projects. If we got up to 20000 entries, and we were hitting 2sec vs 3sec, that might be noticeable and something to address.

cxr 2021-08-17 17:00:25 +0000 UTC [ - ]

> Not sure how you got from this that I was saying that there's no different between react and imba, or that it's not snappy/fast

And I'm not sure where you got that I got that you were saying that.

What I am saying is a direct challenge to what you wrote—no need to repeat yourself. I'm saying, positively, that the common standards in React projects produce bloat that is perceptible—in cases I had in mind, FWIW, that are even more trivial/lightweight, by comparison, than the example of 2000 entries you're relating here.

That you consider a threshold on the order of 2 seconds as beginning to be worthy of something that might need to be addressed is significant. It reveals a fundamental difference in our expectations of software. That "no impact" 0.3 seconds figure is already itself eons in CPU time.

(This isn't generic anti-JS, anti-Web sentiment, by the way. In the early days of developer.mozilla.org—up until 2008 or so—I poured a lot of effort working on the JS documentation to make sure high quality docs would be available to a wide audience, so that even more people might pick up JS, which wasn't taken very seriously at the time. That's also, though, why I bristle at the state of React and frontend development—it has sowed the idea that JS, or maybe just software in general, has to be inherently slow and bloated. The average modern Web project on modern mid-range hardware is more top-heavy and perceptibly less snappy than the Electron-style applications like Netscape, Firefox, etc. from 15 years ago, which ran unJITted on sub-Ghz machines.)

lowercased 2021-08-18 02:49:13 +0000 UTC [ - ]

> "imba.io and the site for Scrimba are way snappy. ...Is it possible that being elbow deep in this stuff has dulled your senses?"

That.

Yes, it's eons. I get that. But the time/effort required to make modifications to be faster isn't something that my some of my clients - with limited budgets - are asking for.

Some are, and they care about speed. Typically there's lower hanging fruit in server side query optimization, reduced payload sizes, etc. But I'm sure you already know that.

I agree with most of your closing paragraph too, btw.

codesections 2021-08-17 13:59:36 +0000 UTC [ - ]

This is a very misleading way to report those results (likely unintentionally). The JS Framework site includes benchmarks for imba-v1.5.2 and svelte-v3.29.4 and reports that they are equally fast (1.04 and 1.05). It shows both as similarly faster than React.

As described in your second link, that benchmark is timing something a bit different – and we don't know how well Svelte would perform on it (I'm guessing fairly similarly, since the overall approach seems similar. But there's no way to know without measuring.)

juanramos 2021-08-17 11:26:03 +0000 UTC [ - ]

Imba looks great! Now that v2 is out, what would you say are your priorities regarding Imba? Is there a roadmap somewhere?

derangedHorse 2021-08-17 11:10:32 +0000 UTC [ - ]

I wonder if there are plans for an imba course on scrimba. I think it would be a fun concept and could be a used as a free introductory course (both familiarizing more of the world with the language and the scrimba platform)

somebee 2021-08-17 11:37:15 +0000 UTC [ - ]

Yes, there are plans for an imba course on scrimba! It is almost comical, but scrimba was originally created with the sole purpose of teaching people Imba. Here we are, 4 years later, finally preparing to make a course :D

rtcoms 2021-08-17 20:38:14 +0000 UTC [ - ]

So meta

A course for learning Imba on scrimba, which was made using Imba to make people learn Imba.

laserpistus 2021-08-17 11:40:08 +0000 UTC [ - ]

Yep, we will be making both individual scrims to use as examples and tutorial about building something more comprehensive.

aabbcc1241 2021-08-19 01:03:41 +0000 UTC [ - ]

The author mentioned it's liberating to not need to manually manage the state.

This is also the downside of react compared to angular. You have to explicitly call function to update state, as oppo to transparent state update in angular or stencil.

I made a react hook (use-state-proxy) using proxy to auto call the set state function but it's still doing the work behind.

Memorized dom in lmba, solid.js and surplus look like more efficient and reasonable design.

adventured 2021-08-17 11:11:47 +0000 UTC [ - ]

0xcoffee 2021-08-17 17:28:58 +0000 UTC [ - ]

Really amazing landing page, normally I just scroll though in one second but now I'm really taking the time to try and understand the examples.

Small note, the clock demos don't update every second in Firefox for some reason. On Edge it worked fine.

MatekCopatek 2021-08-17 10:18:14 +0000 UTC [ - ]

You call it "full-stack" and mention memoized DOM, which makes it sound like it's not only a language but also a framework.

Is there a clear separation between those two parts? Could someone take just the language without the framework and use it for something that's not web related?

somebee 2021-08-17 10:20:41 +0000 UTC [ - ]

You can definitely use 'just the language' part. I'm using it daily for scripting, and we've written a lot of apis and libraries at Scrimba that does not utilize any of the framework-ish features of the language. But to make the tags and styling work really well it (imho) has to be thought of at the language-level.

edu 2021-08-17 11:27:55 +0000 UTC [ - ]

Wow, congrats. It looks great, need to try it. The video gave me the same feeling I had when I watched the original rails demo video [1].

1. https://www.youtube.com/watch?v=Gzj723LkRJY

xutopia 2021-08-17 13:39:10 +0000 UTC [ - ]

I don't get that push to put so much logic in the frontend. Connections are getting faster and if we load only smaller amounts of data in each request we can have a really great experience without the hassle of all this complexity.

49531 2021-08-17 13:51:12 +0000 UTC [ - ]

A couple reasons I can think of: - The less logic you do on the client means more data required to be sent over the wire. - Connections are getting faster but we aren't at the point where they're negligible.

For example, if I need to do complex form validation in real time I could send the form value to the backend, have it validate, and receive a response which introduces a lot potential of failure points. Alternatively I could write some logic on the frontend to validate, and this problem expands as the amount of fields in your form increases.

shatteredspace 2021-08-17 14:48:39 +0000 UTC [ - ]

I'm just starting out in the journey of front-end development as a hobby and have been doing server-side infrastructure automation for my career for almost a decade now - so please bear that in mind with might seem like an ignorant question.

Let's say I have the client-side pick up the bill for logic/computing for form validation. Now for security reasons would I also want validation on the server-side as well due to the fact that client-side JavaScript can be manipulated? Or am I totally off-base in this line of thinking.

I'm personally opposed to how much logic happens on the client-side but I'm open to having conversation and changing my opinion on that.

pier25 2021-08-17 14:54:17 +0000 UTC [ - ]

Validation in the browser is just a UX thing. There's no security in the browser.

cubano 2021-08-17 19:55:37 +0000 UTC [ - ]

browser validation keeps honest people out.

handrous 2021-08-17 15:29:21 +0000 UTC [ - ]

I distinctly recall using a vendor's demo in a no-nonsense show-me-the-money kind of industry, about 4 years back. It was something that would definitely have been built as a "web app" at most shops I've known since, oh, 2012 or 2013.

It was remarkably responsive, fast, and light. Everyone who used it commented on how snappy it was.

It was PHP, doing full-page reloads on damn near every interaction, with minimal Javascript.

xrd 2021-08-17 15:28:18 +0000 UTC [ - ]

The thing I'm looking for, and didn't see it immediately on the example page, is how easily you can use JavaScript libraries. I'm sure you can, but is it like Svelte, where you can just use them almost as-is, or like React and Vue, where you need to wrap them inside special wrapper libraries that expose them as React hooks or whatever.

Svelte is so great because you can use libraries as is. React is great (if you like it) in that it has a huge number of converted libraries and a huge community that is quick to convert new libraries.

Anyone know what the story is for Imba in this light? It looks great at first glance.

trafnar 2021-08-18 04:02:03 +0000 UTC [ - ]

You can import any node module and use it with imba syntax. I’ve never had a problem doing this.

codesternews 2021-08-17 13:05:12 +0000 UTC [ - ]

Congrats

How do you make money out of it?

Are you working full time on this?

Why YC funded this, could you tell me opportunity here?

mstade 2021-08-17 13:39:55 +0000 UTC [ - ]

As far as I understand it, the language came first and in order to teach it to others the founder created a screencasting tool of sorts, which became a company in its own right: https://scrimba.com

Ironically, it seems the company focused on content to teach primarily other technologies while using Imba to build it all. It's a rather fascinating story actually, which I'm paraphrasing and probably mostly got wrong, but if you're interested you can read more on their hiring page: https://scrimba.recruitee.com

N.B.: I'm not in any way affiliated with Imba or Scrimba. The first time I heard of the technology and the company was today, through HN, so I have no skin in this game. I'm probably also mostly wrong about everything above, so you know..

kvakkefly 2021-08-17 16:26:17 +0000 UTC [ - ]

They funded https://scrimba.com, an interactive coding tutorial platform, that is written in Imba.

Artistry121 2021-08-17 13:24:54 +0000 UTC [ - ]

Scrimba

peey 2021-08-17 14:37:09 +0000 UTC [ - ]

1. Would it be correct to describe memoized DOM approach as combination of direct manipulation (like hand-written jquery, or what svelte compiles to) + a mechanism to avoid invoking selectors by caching references to DOM elements? Or is there more to it?

2. It'd be a good experiment to separate out the memoized DOM implementation from imba codebase in a way it can be used by different frameworks, just as virtual DOM libraries got popular after react. If someone were to attempt this, where would you recommend that they start with the imba codebase?

arodyginc 2021-08-17 13:14:53 +0000 UTC [ - ]

Using two-way databinding, how do you control the updates when it triggers other updates and so on? Is there any kind of loop control like say in Angular?

valyagolev 2021-08-17 10:55:08 +0000 UTC [ - ]

is there any particular reason why there doesn’t seem to be built-in type-checking system? i know it still seems to be a “personal preference” whether to check one’s types, but i wonder if any thought was given to including it?

somebee 2021-08-17 11:18:16 +0000 UTC [ - ]

There is built-in type-checking, but currently only via the tooling. It integrates with TS as a language service plugin (https://github.com/Microsoft/TypeScript/wiki/Writing-a-Langu...) so you get great warnings/errors, type inference and much more. To define standalone types or interfaces you still need to use `.d.ts` files, but that may change in the future :)

valyagolev 2021-08-17 12:15:15 +0000 UTC [ - ]

that is to say, the types are not part of the syntax in any way?

somebee 2021-08-17 12:19:16 +0000 UTC [ - ]

You can typeset variables, parameters etc (ie. see the code in https://dev.to/somebee/global-type-augmentations-with-automa...). But declaring standalone types is still done in `.d.ts` files. Imho, the type inference in ts/js is getting so good that I very rarely need to declare any explicit types in my own projects.

k__ 2021-08-17 11:14:38 +0000 UTC [ - ]

Interesting.

I had the impression "tightly coupled with TS" would mean type checking.

That's sad.

nwienert 2021-08-17 16:59:32 +0000 UTC [ - ]

I think the general idea is good, but then again I built a whole startup from the same principles ~6 years ago.

It’s actually pretty impressive how similar Imba is to motion, our project. We forked Babel at the time, added a “view” expression that worked like a class but far simpler, and within view bodies you’d have full reactivity of variables. What’s nicer than Imba, I think, is that you get mostly vanilla JS syntax, nothing new to learn, and it’s 100% React so click handlers are plain JS expressions just like React.

We ended up not launching it, and we were re-writing it but never ended up launching the re-write or the original (though the original is on my GitHub somewhere I think).

Best of luck!

https://youtu.be/HHTYHm6qLFY

debarshri 2021-08-17 09:24:38 +0000 UTC [ - ]

Hey there! I think it is really cool language. You can basically get started in minutes.

Does imba also have native app framework too?

somebee 2021-08-17 09:45:23 +0000 UTC [ - ]

No, not right now. The current version of tags is relatively tightly coupled with the DOM for maximum performance. It should be possible to create a bridge like react-native but it hasn't been an area of focus thus far!

canada_dry 2021-08-19 01:43:30 +0000 UTC [ - ]

OP, could you add some code to detect when javascript is disabled. A small thing, but a pretty common thing you should deal with.

lowi 2021-08-17 13:21:34 +0000 UTC [ - ]

1. Do you have a recommanded way for i18n integration? 2. What's the performance of updating/adding/deleting a single entry in an array? Will imba just update the html element in O(1) or it will iterate the array to delect the changes?

th3h4mm3r 2021-08-17 20:29:30 +0000 UTC [ - ]

First of all really a great work! Incredible!

Second, in my opinion, looking at the documentation, I don't understand all immediately or, better, I've got a little bit of confusion regarding a lot of things.

I'm unable to find "connections" with other languages / frameworks that I use every day (for example Angular, Vue and so on). So my question is: is somewhere some big example in the style of "Angular Heroes" example?

I really want to understand better every single part of Imba and I think that with an extensive example it could be more simple and fast.

Thank you.

ita 2021-08-17 14:49:57 +0000 UTC [ - ]

Is there an example of importing js functions to imba, or calling imba from inside js or ts? I could not find this.

In Scala js, this interoperability is quite painful, so I wanted to see how easy it is in imba.

akvadrako 2021-08-17 10:56:45 +0000 UTC [ - ]

This looks pretty good, but it would be better if you compared the performance and rendering approach to Svelte instead of React and Vue. It's well known that virtual DOMs are not good for performance.

xavloper 2021-08-17 10:10:31 +0000 UTC [ - ]

This is very cool. It seems like the perfect language for making web components. Do you have a "compile as component" mode to output components or component-like packages (like Angular Elements)?

habosa 2021-08-17 13:47:39 +0000 UTC [ - ]

Congrats on the new launch! Scrimba, which could not exist without Imba, is one of those insane magical web things that is criminally under-appreciated. I hope Imba takes off!

krmmalik 2021-08-17 14:09:49 +0000 UTC [ - ]

Interesting. I haven't watched the video get but I'm interested to know how is Imba for low-coders like me? React has a huge ecosystem around it and while it is not low-code, component libraries make adoption a bit more of a no-brainer so I'm interested from that perspective.

I've currently been working on a Blockchain app with a low-code back-end which is almost complete now and the front-end is supposed to be done in React but I'm open to alternatives.

qwerty456127 2021-08-18 07:54:04 +0000 UTC [ - ]

Looks great. What are the cons? Why should I not use it? Every technology has some.

soheil 2021-08-17 14:19:58 +0000 UTC [ - ]

How does one create a (for profit?) company around a programming language and starts posting jobs? There is nothing about monetization on their website.

wccrawford 2021-08-17 17:31:01 +0000 UTC [ - ]

How does it know whether to run the code client-side or server-side? How easy is it to accidentally end up creating SQL statements client-side and running them on the server?

If all the code runs server-side, is it not possible to create modern web apps on it where most interactions happen client-side, or does every request have to wait for the server's response?

quickthrower2 2021-08-17 22:42:20 +0000 UTC [ - ]

It’s a double take to see scrimba as a YC company because I used them a while back so feel like they are an established company not a startup. In any case the experience of learning React on that platform is wonderful and gave me the best long term recall performance of any course I have done.

shireboy 2021-08-17 11:52:07 +0000 UTC [ - ]

Looks great! I’ll definitely be checking this out for my web work. One thing I see- and only mention because the rest of the product seems like it has an eye for detail- the “we are hiring” link and paint component on imba.io have minor layout issues on iOS Safari on iPhone 12 Max Pro. I haven’t tried other devices, but mobile responsiveness is one thing I look at when evaluating tools like this.

shaunxcode 2021-08-17 16:14:35 +0000 UTC [ - ]

This is the first time I have seen a language that extends/integrates markup in a way that does not feel superfluous.

mkl 2021-08-17 21:37:08 +0000 UTC [ - ]

Hi Dan, I noticed that the links in the post are actual links here, unlike usual and what https://news.ycombinator.com/formatdoc says. Is this new? Is it just for Show HNs?

dang 2021-08-17 23:45:57 +0000 UTC [ - ]

We linkify text submissions for Show HNs and other interesting text posts where it's clear that the feature isn't being misused. I did that on the OP.

See also https://news.ycombinator.com/newsfaq.html:

Q: How do I make a link in a text submission?

A: You can't. This is to prevent people from submitting a link with their comments in a privileged position at the top of the page. If you want to submit a link with comments, just submit it, then add a regular comment.

c-smile 2021-08-17 20:26:45 +0000 UTC [ - ]

> Imba's Memoized DOM approach is an order of magnitude faster than Virtual DOMs (Vue, React). Learn more here: https://www.freecodecamp.org/news/the-virtual-dom-is-slow-me...

Just in case...

Sciter's native built-in Reactor https://github.com/c-smile/sciter-js-sdk/tree/main/docs/md/r... is using that so called "Memoized DOM" approach, which, as far as I understand the wording, is "diffing with real DOM": you have real DOM tree on the left and virtual DOM tree on the right. Reconciliation in this case is just patching of the left tree by the right one.

Essentially Sciter's Reactor is a unification of React with WebComponents ideas into single entity.

mixmastamyk 2021-08-18 03:41:40 +0000 UTC [ - ]

As a person who knows the big three H,C,J, I'm still a bit lost in the docs. They assume a lot of knowledge about web components, React, javascript tools, and other things.

I didn't make it to a hello-world page.

philmcp 2021-08-17 15:56:27 +0000 UTC [ - ]

Very cool, good luck! I'm sure you'll do great

p.s. if you would be open to listing your positions on a 4 day work week (even at 80% salary) I'd be more than happy to promote them on https://4dayweek.io + the newsletter for free

k4runa 2021-08-17 11:00:50 +0000 UTC [ - ]

Would it be possible with this to just apply tailwind css classes instead of learning this built in style syntax?

somebee 2021-08-17 11:02:12 +0000 UTC [ - ]

Sure, you can apply tailwind classes like `<div.w-32.h-32.rounded-full>` etc, but I'd definitely recommend using the built in styling as it is much more powerful (value interpolation, flexible modifiers etc).

k4runa 2021-08-17 11:05:56 +0000 UTC [ - ]

Great! I am interested in trying out the language and learning more but there would be a lot less friction and mental confusion on my side if I can get started and apply tailwind classes and use something I'm familiar with.

nsomaru 2021-08-17 20:19:02 +0000 UTC [ - ]

Just wanted to say thank you for the purchasing power parity discount on scrimba.com

Very very cool!

errantspark 2021-08-17 16:56:10 +0000 UTC [ - ]

Very cool stuff, as a baseline I have about zero interest in a compile to JS language but this seems like it might actually lift more than it weighs! Really appreciate the documentation, examples and terseness of the code.

P.S. Nobody calls it San Fran :`D

ArlenBales 2021-08-17 22:21:15 +0000 UTC [ - ]

Really cool. This looks like an ideal language for super quickly developing small apps. I am probably going to use this to write a very minimalist hiking photo blog I've been putting off.

burlesona 2021-08-17 13:51:23 +0000 UTC [ - ]

This looks awesome, thanks for sharing! I love "bringing the elegance and concision of Ruby into the browser." I happen to be about to spin up a new project, so I'll give this a shot and see how it works in practice. Cheers!

adam_ellsworth 2021-08-17 21:13:18 +0000 UTC [ - ]

Absolutely stunning work. Love that it's able to work so well with TS. Also please tell Puppetmaster Pumpkin 'Hello' on my behalf and give some head scritches :3

dvt 2021-08-17 16:47:09 +0000 UTC [ - ]

Congrats on the launch! Like everyone else, I wanted to say great splash page and the syntax looks quite beautiful. Will do more of a deep dive once I get some free time, but it's quite promising.

turtlebits 2021-08-17 16:36:36 +0000 UTC [ - ]

I wanted to like Imba, but there was no hash based router. (Required for static sites without having to redirect on the server). Quickly looking at the docs looks like that is still the same.

agd 2021-08-17 20:06:39 +0000 UTC [ - ]

This looks great however I’m skeptical about dom memoization. VDOM + immutable data structures seems to be much simpler conceptually and may provide even better performance.

jvalencia 2021-08-17 16:18:25 +0000 UTC [ - ]

I came in thinking "ug" like this will go anywhere. Then I looked at imba.io and it totally made the case for it. Great job! Now I want to try it.

SkyMarshal 2021-08-17 16:22:33 +0000 UTC [ - ]

You had me at "indentation-based syntax". :)

daveidol 2021-08-17 17:31:44 +0000 UTC [ - ]

Lost me there tbh :)

zenosmosis 2021-08-17 16:15:06 +0000 UTC [ - ]

Beautiful project.

Imba website looks great and the code examples explain it well. The React-like server-side rendering with the .html imports is phenomenal!

hydroxideOH- 2021-08-17 15:30:00 +0000 UTC [ - ]

There's a lot of css issues on mobile on imba.io

warent 2021-08-17 15:34:06 +0000 UTC [ - ]

Yep, I'm on mobile and the website doesn't really give me much confidence in how Imba works with responsive development

johschmitz 2021-08-17 16:13:18 +0000 UTC [ - ]

True, it doesn't seem to work so well, see screenshot: https://pasteboard.co/KgkhOEo.jpg

thomasfl 2021-08-17 11:06:10 +0000 UTC [ - ]

Always impressed by what you are able to achieve Sindre.

prionassembly 2021-08-17 17:20:05 +0000 UTC [ - ]

> Getting started > > The best way to get started with Imba is to use npx to get a brand-new project up and running.

What is npx?

politelemon 2021-08-17 17:42:56 +0000 UTC [ - ]

It's a tool that comes with NodeJS.

npx will run the node package from node_modules if it's present, else it will npm install the package and then run it.

rovr138 2021-08-17 17:28:33 +0000 UTC [ - ]

It's a command from node that allows executing commands from node_modules.

mleonhard 2021-08-17 17:37:01 +0000 UTC [ - ]

How useful are the compiler error messages? I would like to see an example compiler error on the intro page.

mleonhard 2021-08-17 17:34:57 +0000 UTC [ - ]

Does Imba have good tools for testing? I didn't find 'test' in the Imba docs.

nickthemagicman 2021-08-17 10:11:06 +0000 UTC [ - ]

Looks great!

From a first look, I love the dimension types and the tags which compile down to native web components.

Hope good things for this.

divs1210 2021-08-17 17:48:44 +0000 UTC [ - ]

The product is really cool, and so is the language! Congratulations and all the best!

math0ne 2021-08-17 19:32:10 +0000 UTC [ - ]

Some cool ideas here, I love that everything looks so small and cute!

ampdepolymerase 2021-08-17 14:20:00 +0000 UTC [ - ]

Are there any companies using Imba in production aside from Scrimba?

throw_m239339 2021-08-17 11:07:13 +0000 UTC [ - ]

Looks great! Congrats for being a YC alumni. One day myself perhaps...

keithnz 2021-08-17 10:23:08 +0000 UTC [ - ]

is there direct support for websockets? channels or something?

pier25 2021-08-17 14:57:54 +0000 UTC [ - ]

You can use all browser APIs as if you were using JS.

soheil 2021-08-17 14:21:10 +0000 UTC [ - ]

> Amazing Performance

With no benchmarks to back up that statement?

pier25 2021-08-17 14:57:06 +0000 UTC [ - ]

Here are some results for v1:

https://krausest.github.io/js-framework-benchmark/current.ht...

(but the author claims v2 is much faster)

dmead 2021-08-17 14:48:34 +0000 UTC [ - ]

does this take any inspiration from links?

https://links-lang.org/

abdellah123 2021-08-17 15:23:06 +0000 UTC [ - ]

Does Imba support SSR? is it in the roadmap?

whiddershins 2021-08-17 19:14:50 +0000 UTC [ - ]

How would you compare this to svelte?

still_grokking 2021-08-17 21:28:28 +0000 UTC [ - ]

It feels indeed snappy and fast.

I'm impressed!

k__ 2021-08-17 11:05:25 +0000 UTC [ - ]

Reminds me of my LiveScript days.

I'm impressed!

jokethrowaway 2021-08-18 09:23:24 +0000 UTC [ - ]

Looks neat and the website is simply awesome.

I personally wouldn't use it.

I'd rather go for something closer to JS or for something closer to FP like elm (if only they didn't have that dictatorship fixation issue).

I would recommend investing in fast and safe tooling. After years of typescript I switched to swc (written in rust) and the difference in productivity is night and day. No more OOMs, much faster, no more hanging processes with vscode.

Best of luck!

imvetri 2021-08-17 12:10:08 +0000 UTC [ - ]

Not highjacking but learning that you have spent 7 years to solve a problem gets me. I started something 7 years back with an idea, been learning things for 3-4 years and started implementing 3 years back. The timeline is coinciding.

Here is what I have

https://github.com/imvetri/ui-editor

thobond 2021-08-17 14:19:16 +0000 UTC [ - ]

Are there any other commercial companies, or is there someone who has used imba to develop their web apps except for OP?

cortexio 2021-08-17 15:50:42 +0000 UTC [ - ]

i wouldnt call it a language, it basically asks u to install nodejs, which is the actual language itself. U do however have a custom syntax, but i find your project much more like a web framework. Personally i would add strict typing. But that's just me i guess :)

truthwhisperer 2021-08-17 20:34:07 +0000 UTC [ - ]

sorry waste of time

arodyginc 2021-08-17 15:02:48 +0000 UTC [ - ]

So, had gone through samples and my conclusion as a seasoned web dev with projects as big as having thousands of files with hundreds business scenarios, imba is not the setup for this scale.

When people come and go, requirements change, new tools come along, trading flexibility to some initial development boost is not worth it, imo

mleonhard 2021-08-17 17:39:43 +0000 UTC [ - ]

Next time, please explain why.

mg 2021-08-17 10:07:28 +0000 UTC [ - ]

One thing that irks me about Javascript is "const". I think it should have been called "con". "var", "let", "con".

So the first thing I did here is look up the docs and see how variables are declared. Aaarghh.. "let" and "const" again :)

__ryan__ 2021-08-17 12:23:55 +0000 UTC [ - ]

I've thought about this a lot. I considered "con" for constants. I don't hate it. It also works as a double entendre-- "con" in Spanish means "with". So the following code could be read as "with name equal to Brad".

  con name = 'Brad'
I can't help but feel that it's somewhat jarring though.

If I had my druthers, I think I would choose "var" and "def" to declare mutable and immutable variables, respectively.

  def PI = 3.1
  def degreesToRadians = degrees => degrees * (PI / 180)

  var degrees = 180
  var radians = degreesToRadians(degrees)
Edit: After thinking about it some more, I think I prefer "const" over "con", but "def" over both.

Shorel 2021-08-18 01:52:59 +0000 UTC [ - ]

Spanish native here. I would never read it like that.

I have programmed in a couple languages where every single keyword was in Spanish: Logo and some flavours of Visual Basic.

Either everything is in English, or everything is in Spanish. There's no middle ground with mixed keywords.

'Var' and 'def' both sound good to me.

Zababa 2021-08-17 13:51:30 +0000 UTC [ - ]

> It also works as a double entendre-- "con" in Spanish means "with".

Triple even! In French it's the equivalent of "cunt".

CRConrad 2021-08-18 21:29:16 +0000 UTC [ - ]

And in English, to go full circle, a con is what a con man pulls; a confidence trick.

Hey BTW, is a JS "const" really constant, or can it (like in some other languages) be changed after all? Because if it can, then it isn't really const but more of a con...

Zababa 2021-08-19 13:37:21 +0000 UTC [ - ]

> Hey BTW, is a JS "const" really constant, or can it (like in some other languages) be changed after all? Because if it can, then it isn't really const but more of a con...

It's constant for things like numbers, but if you declare an array const, the only const things is the reference, the array can still mutate. con might be a good name for that.

lucideer 2021-08-17 10:15:45 +0000 UTC [ - ]

Why do you think this?

"const" seems clearer to me. "con" seems very open to misinterpretation: could mean many things.

Are there any advantages to "con" over "const"?

mstade 2021-08-17 10:25:43 +0000 UTC [ - ]

My guess is the OP dislikes the difference in keyword length.

cgag 2021-08-17 13:31:40 +0000 UTC [ - ]

I just always use let because it looks better. Const provides pretty much no value in js anyway.

jsf01 2021-08-17 13:50:09 +0000 UTC [ - ]

It is useful for code readability. When you’re skimming and trying to understand a large chunk of code, if almost all the variables are declared with “const” and then you come across a “let”, you immediately know to look for where it will be mutated elsewhere.

amalantony06 2021-08-17 10:11:36 +0000 UTC [ - ]

Why does const irk you? const sounds a lot clearer than con. Is that your primary criteria for picking a language? ;)

mg 2021-08-17 10:24:40 +0000 UTC [ - ]

I think it has three reasons:

The more often a construct is used in a language, the shorter I like it to be.

It groups variable definitions mentally by having them all the same length if they are "var", "let" and "con".

It would often make the code look more uniform which is more beautiful in my eyes. Example:

https://github.com/facebook/react/blob/cae635054e17a6f107a39...

I would prefer the lines 226 and 227 to start with "con" and "let". It would make the code visually more appealing to me.

jazzyjackson 2021-08-17 10:31:22 +0000 UTC [ - ]

As far as code being visually appealing, for me those two lines are the least of that code’s troubles.

I’m sympathetic to wanting code to have good aesthetics. If I was writing those lines I probably would have daydreamed for 5 minutes thinking of new names for map and record so that the equal signs would line up.

CRConrad 2021-08-18 21:47:12 +0000 UTC [ - ]

   con map = ...

   let rec = ...

2021-08-17 10:34:14 +0000 UTC [ - ]

veidr 2021-08-17 12:16:15 +0000 UTC [ - ]

You are obviously right.

The 'const' nomenclature is an abomination before science and human progress. However, given the prior art, I don't think we can hold it against a new/emerging language.

Anders, help us! Do the right thing. You are the only one who can.

(Of course, 'const' could be grandfathered and still work forever. Right-minded people, please upvote this obviously-right person at least back to a neutral #000.)

somebee 2021-08-17 10:10:12 +0000 UTC [ - ]

Tbh, var is actually deprecated since v1, so any mention of var in the docs is a mistake. Are there any other languages using 'con' for constants?

veidr 2021-08-17 12:27:28 +0000 UTC [ - ]

No, but there should be!!

OJFord 2021-08-17 10:47:23 +0000 UTC [ - ]

I've never used a language with a 'cons' keyword, but nevertheless that's what I'd assume your 'con' was, if you didn't tell me otherwise.

I'm no particular JS fan, but 'const' is much clearer, it's a complete syllable, just like 'var' or 'func'. Yes 'fun' is used, but I think that's awkward for the same reason.

2021-08-17 14:25:45 +0000 UTC [ - ]

scns 2021-08-17 10:12:52 +0000 UTC [ - ]

Good idea IMO. That feature should be pretty easy to add (famous last words).

nsonha 2021-08-17 14:35:41 +0000 UTC [ - ]

if we want to nitpick I hate the fact that many dynamic languages need keywords to express very little information.

If js was made with types then the syntax `any x` (yeah lose the colon too, who gives a shit) is suficient to express that x is a variable, then `number x` could mean variable of type number, and `const number x` could mean constant of type number.

Zababa 2021-08-17 10:16:17 +0000 UTC [ - ]

Is the difference in length bothering you? In that case I find that let for immutable and var for mutable is pretty good, although for a language that's lose to JS that might not be a good idea. Maybe let for mutable like in JS, and val for immutable? (inspired by Scala).

jazzyjackson 2021-08-17 10:25:04 +0000 UTC [ - ]

Personally I don’t use any languages with reserved words

therufa 2021-08-17 11:05:28 +0000 UTC [ - ]

that limits the number of languages to a handful. like brainfuck and similar ones. doesn't it?

jhgb 2021-08-17 12:06:57 +0000 UTC [ - ]

Lisps don't have reserved words, generally.

jazzyjackson 2021-08-17 12:12:57 +0000 UTC [ - ]

Not even cons and defun?

jhgb 2021-08-17 12:31:33 +0000 UTC [ - ]

Depends on what you mean by "reserved word". In Common Lisp, you can define your own cons and defun, provided that you're not attempting to mutate the respective symbols from the COMMON-LISP package. That can be achieved by either defining your own cons and defun and shadowing the cons and defun from the COMMON-LISP package (typically for function or macro bindings), or just straight up using cons and defun from the COMMON-LISP package in "legal" ways - for example (let ((cons 1) (defun 2)) (list cons defun)) is legal and evaluates as '(1 2) since using those two symbols as names for lexical variables doesn't break the running Lisp in any way. In the former case (of defining your own functions/macros accessed as "unqualified" cons or defun from your own code) it's up to you if you consider cons and defun to be "reserved words" based on their package or not (packages for reserved words being something that languages explicitly recognizing the concept of a reserved word don't seem to have, so it's not clear how this should qualify). In Scheme, a Lisp-1, it's kind of free-for-all, especially in R5RS where you don't even have to bother with hiding standard bindings.

jazzyjackson 2021-08-17 12:12:18 +0000 UTC [ - ]

APL cheats by making everything a symbol.

lyrachord 2021-08-18 14:20:15 +0000 UTC [ - ]

Why should there should be a flag word before IDentifier, indeed the answer is.

[constant variable name] = value

is not the right thing?

nsonha 2021-08-17 14:21:43 +0000 UTC [ - ]

I can't believe it, this even has a dsl on top of css, baked in, as if that alone isn't a controversial thing. The rest of the language is really just around "least amount of characters", a really lame motivation that has been done countless times in my lifetime.

I'm all for new programming languages but you need to justify it with actual new ideas and new ways of thinking not some opinion about syntax. Guess what? everybody has one, they're all different.

graderjs 2021-08-17 10:46:01 +0000 UTC [ - ]

Wow you are clearly a genius. The syntax looks beautiful! This is great. I don't want to use it (the best tool for the job for me is one that fits my own mental models, my own mind, and this is not it) but you are a genius.

Also -- wow those Nordics are super productive programmers/coders/developers/open-sorcerers (Sindre Aarsaether & Sindre Sorhus & Linus Torvalds & ...<please insert other names below to educate me>...) -- could it maybe have something to do with: The low GNI, the high HDI and the great weather for coding? (cold, blistery, bleak, focused, electrons-and-light universe is only outlet in a desolate landscape)? I have been to Oslo. The architecture is great.

PS - I use my own memoized DOM with minimal/granular updates in my own quirky framework (https://github.com/i5ik/vanillaview)

PPS - BTW memoized DOM is a great term of art. I perhaps shall be using it from now.

CONGRATULATIONS, SIR!

PPPS - Also what you are doing with Scrimba is so incredible. And GOOD. You are such a fuqing genius. Wow!

CRConrad 2021-08-18 21:59:30 +0000 UTC [ - ]

> please insert other names below to educate me

Bjarne Stroustrup, Anders Hejlsberg.