My name is Sindre, and I am the CTO of Scrimba (YC S20). For the last 7 years, I have written all my web apps in a full-stack programming language called Imba. It compiles to JavaScript and its main goal is to make web developers more productive.
I just launched a major overhaul of Imba, so I wanted to share it here on HN, in case anyone are interested in learning more about it. It is very opinionated, so some of you might not like it, but I would love to hear anyones feedback regardless. Constructive criticism appreciated!
The backstory:
Imba initially started in 2012 as an effort to bring the elegance and conciseness of Ruby into the browser, and also because I felt that JavaScript and the DOM should be more tightly coupled together. Over the years, I have taken inspiration from React/JSX, and also Tailwind.
Since 2013, I have built several business-critical apps in Imba, so this is not a toy project or an academic exercise, it is extracted from a real project trying to solve real problems. Today, we are currently a small but passionate community of devs who use Imba all over the world.
The nitty-gritty details:
As mentioned, Imba compiles to JavaScript, and it works on both the frontend and backend. The quickest way to get a feeling of how it works is by checking out this video: https://www.youtube.com/watch?v=8XS5q9xhaMc
Alternatively, here is a list of the main benefits of the language:
* Clean syntax with built-in tags and inline styles
* 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...
* Imba works with Node and the npm ecosystem, and integrates tightly with both JS and TypeScript
* Blazing-fast dev/build tools based on esbuild
Each of the benefits above are explained more thoroughly in our docs here, so please check it out if any of the above points spark your interest: https://imba.io
With this version I feel that I am very close to my vision for what Imba should be. In other words; it is finally ready for public consumption. I'd wholeheartedly advice you to look into it and give it a whirl if you are interested in web development :)
Hope you like it, and please share any feedback you might have in the comments!
PS! We're also hiring Imba developers at Scrimba - see https://jobs.scrimba.com/. We don't expect you to be a seasoned Imba developer, but we expect you to pick it up fast :)
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
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.
I.e //app.js ...
//my-todo.js ....
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.
EDIT: ah - butter smooth in edge (and presumably chrome too), but laggy in firefox.
Repo: https://github.com/imba/imba
Docs: https://imba.io/language/introduction
Video: https://www.youtube.com/watch?v=8XS5q9xhaMc
Article: https://dev.to/somebee/imba-a-javascript-alternative-for-inc...
Site: https://imba.io
Discord: https://discord.gg/mkcbkRw
Twitter: https://twitter.com/imbajs
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. 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.
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)
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...
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.
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.
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-...
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.
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.
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.
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...
> 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.
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.
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.
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?
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.
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.
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).
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.
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.
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.
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).
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).
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.
So, if you split by technology, you don't have the code belonging to one feature in one place.
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).
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.
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.
When all three of these things have to care very directly about eachother, separating them makes less sense.
https://adamwathan.me/css-utility-classes-and-separation-of-...
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
sounds like the kind of thing that programming was invented to eliminate
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?
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.
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.
Coffeescript was a breath of fresh air compared to writing ES5.
I see it in less visual clutter.
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.
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.
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.
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.
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.
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.
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.
Just my novice view.
https://github.com/krausest/js-framework-benchmark
Great work so far, I’m excited to give imba a spin.
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!
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.
<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.
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.
fs = font-size
fw = font-width
ta = text-align
c = color
So that the primitives match what people are familiar with from before, and match the actual web standards/specifications.
So that code which is reproduced and communicated online is also immediately readable for people who are not familiar with the abbreviations.
To gain adoption, reducing onboarding friction is key, and judging from my impression of Imba, as well as others' comments here, I think a lot of that unnecessary friction could be reduced.
On the other hand, if pros like reading very terse code, maybe an IDE plugin could be made to toggle the abbreviations.
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.
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?
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.
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 :)
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.
The truth about Svelte: https://gist.github.com/Rich-Harris/0f910048478c2a6505d1c321...
Svelte was a minimalistic and familiarity-optimised response to Imba:
"These projects are all very cool, but there's a reason they haven't hit mass adoption: they want to control the entire world. You can't adopt Elm or Imba incrementally" - Rich Harris of Svelte
Imba: Created in 2010. Released some 7 years ago, Github repo in around 2015. https://imba.github.io/imba-guide/lvl0/about/
Svelte: Initial release November 26, 2016. https://en.wikipedia.org/wiki/Svelte
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.
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)
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.
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.)
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?
Small note, the clock demos don't update every second in Firefox for some reason. On Edge it worked fine.
A course for learning Imba on scrimba, which was made using Imba to make people learn Imba.
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.
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.
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.
I had the impression "tightly coupled with TS" would mean type checking.
That's sad.
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.
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?
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..
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?
In Scala js, this interoperability is quite painful, so I wanted to see how easy it is in imba.
Does imba also have native app framework too?
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!
1. The two-way data-binding. I'm sure a lot of developers have gotten it ingrained that "two-way data binding is bad and doesn't scale to large apps and teams".
2. Server-side rendering. 2.1 How does it work? 2.2 Is it limited to sending html strings like in the landing page example? 2.3 Will Imba render the app/page on the server before sending it to the client? 2.4 How does it compare architecturally to a React/NextJS combo?
The landing page could beneficially have addressed these two concerns briefly, and linked to a follow up discussion. I'm sure it is top-of-mind of many developers, and a potential (unnecessary?) turn-off.
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.
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.
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.
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!
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?
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
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.
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.
P.S. Nobody calls it San Fran :`D
Very very cool!
I didn't make it to a hello-world page.
https://krausest.github.io/js-framework-benchmark/2021/table...
Imba website looks great and the code examples explain it well. The React-like server-side rendering with the .html imports is phenomenal!
What is npx?
npx will run the node package from node_modules if it's present, else it will npm install the package and then run it.
From a first look, I love the dimension types and the tags which compile down to native web components.
Hope good things for this.
With no benchmarks to back up that statement?
https://krausest.github.io/js-framework-benchmark/current.ht...
(but the author claims v2 is much faster)
I'm impressed!
I'm impressed!
When people come and go, requirements change, new tools come along, trading flexibility to some initial development boost is not worth it, imo
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.
So the first thing I did here is look up the docs and see how variables are declared. Aaarghh.. "let" and "const" again :)
"const" seems clearer to me. "con" seems very open to misinterpretation: could mean many things.
Are there any advantages to "con" over "const"?
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.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.)
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.
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.
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!
Bjarne Stroustrup, Anders Hejlsberg.