Live data from Hacker News

Imba – A new programming language for the web

imba.io

71–80 of 180 posts

Re: Imba – A new programming language for the web

#71

Why do people keep throwing around the idea that "X tool is Y times faster than React?" Last I checked no one was claiming React is super fast and I don't know anyone who uses it for its speed. It just seems like such a strange thing. It's like building a new car and claiming it's 100 times faster than riding a horse.

Virtual DOMs were pretty much invented while searching for a way to get higher rendering speeds. Just google "virtual dom speed".

Re: Imba – A new programming language for the web

#72
post #61

Earlier quoted context omitted.

That's not specific to 'unless' – it's the general postcondition style that's is derived from Ruby. Indeed, for single-line if statement bodies in Ruby, it's the recommended style. It fits the style of Ruby to try and cut down on syntax noise where it's not needed. Contrast: save! if !record.persisted? && !record.invalid? save! unless record.persisted? || record.invalid? Though I do appreciate it's a bit unusual comp…

That's not really the part of unless that bothers me - it's the order. Why not do: if !record.persisted? && !record.invalid? save! or: unless record.persisted? || record.invalid? save!

I guess it's generally just that it's regarded as fairly idiomatic Ruby. bbatsov's popular style guide, for example (https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier):

The same applies to while/until loops, which can lead to quite succinct code.

I've been using it for a long time, so I don't find it confusing at all – but I agree it's pretty rare to find, so I'm not surprised to find out some people would rather not see that!

Re: Imba – A new programming language for the web

#74
Interesting, great work. As someone who's never been able to get on board with JavaScripts syntax, this looks like a viable alternative to CoffeeScript.

Also, for React applications I've found that LiveScript (a functional compile to JS language) makes for a great JSX alternative as shown here: https://arch-js.github.io/docs/02-basic-tutorial.html

Re: Imba – A new programming language for the web

#75
post #58

This isn't a competitor to react; its a competitor to ES6/typescript/coffeescript. React is a template library, not a language. JSX is a way to write templates, but that's not react, and its not what react does. It's just a shortcut to writing XML. You could say this is a competitor to JSX, perhaps; but anything more is hyperbole. People aren't using react and angular because they have a nice syntax , that's just nic…

Mithril author here. It does appear to have a React-like engine here: https://github.com/somebee/imba/blob/master/src/imba/dom.sta... , but from a quick glance, I can't tell if the quality of the engine is any good (e.g. whether it supports lifecycle methods, efficient sorts, jQuery plugins, etc) because there are no docs and I don't really have time to read the whole codebase right now. Same goes for the speed claim…

> The lack of docs is a showstopper for me, however.

That's a fair criticism. We know that docs are severely lacking. But at one point you'll have to release it. The reason it's been private for all these years is because there's always been just one more thing to fix.

And this is just an open-source project. We just think this is a cool technology and want to share it with the rest of the community.

> Same goes for the speed claim: can't tell if it's actual speed or "cheating" by batching multiple redraws on rAF and while not batching them in the React demo. I'm guessing the latter.

Hah, we talked about this before the release. We actually thought about publishing worse results (or adding some code to slow it down) because we were afraid people wouldn't believe it.

requestAnimationFrame isn't used in this demo. The repaint/redraw is not the thing we are trying to benchmark. We might as well hide the whole app during the benchmark, or even detach it from the document. It is trying to measure the performance of bringing the whole view "in sync". If there is something wrong with the way Mithril is forced to render, please file an issue.

> lifecycle methods, efficient sorts, jQuery plugins

There's probably some more lifecycle methods that could be useful, but the amount of lines written in Imba is in the magnitude of 100k. The current approach has been adequate for that.

The sorting is quite efficient. We find the minimal amount of nodes that needs to be reordered. jQuery plugins should work fine as long as they don't touch the parents too much; Imba is quite good at keeping the DOM-node in the tree.

Re: Imba – A new programming language for the web

#76
post #14

Disclaimer: I've been following the development of Imba while it's been a private project (for six years now). Lately I've been helping out fixing bugs and improving smaller parts of the language. Having tags as a proper part of the language is very nice. This just works in Imba: for event in @events if event:type == "like" elif event:type == "comment" In React I'd have to use `map` and refactor parts into variables.…

Can't really comment re the language (the tags as part of the language is very nice, I agree), but it's been in development for 6 years and there are no docs? If it were just a Coffeescript fork & just basically a matter of syntax, then maybe fair enough (but LiveScript & CS both have relatively extensive docs), but this project has much grander claims (ie that it's also a high-level framework competitor) + a grand t…

Unfortunately we were too busy building actual applications. In total it probably sums up to a number in the magnitude of 100k LoC.

EDIT: But yes: Docs are lacking, and that is a reason for you to not pick Imba for a project right not. We'd still think it would be worthwhile for you to checkout though. There's some interesting ideas in there.

Re: Imba – A new programming language for the web

#77

Why do people keep throwing around the idea that "X tool is Y times faster than React?" Last I checked no one was claiming React is super fast and I don't know anyone who uses it for its speed. It just seems like such a strange thing. It's like building a new car and claiming it's 100 times faster than riding a horse.

If only horses existed, and you were the first to make a car, would it not be an apt comparison? With performance at 100k renderings per second you don't need to care about keeping the view in sync anymore?

Re: Imba – A new programming language for the web

#78

I have to admit I was really not excited to see this: var answer = if number == 42 The language looks shockingly pleasant in a number of ways, but everything being an expression seems odd. Would somebody mind helping me understand the value (semantic, performance, etc.) of such a choice?

This comes directly from Ruby via Coffeescript. It's aligned with a general approach of reducing syntax noise, and it can result in some really nice, clean code. It leads to a whole class of syntax possibilities, like implicit returns. There are probably some performance arguments against this in the case of Coffeescript, especially wrt constructing expensive return values that are immediately discarded. The consiste…

Does Ruby allow the value of the if statement to be used as the RHS of an assignment? That's surprising. In Perl, which I assume they got that from (it's a fairly safe bet, Ruby is heavily Perl influenced), postconditionals are not allowed to be used as a statement, they are statement modifiers. You can do this:

  $v = 1 if $v  10;
But you cannot:

  $v = if $v;
You also cannot use else on postconditionals (if it's that complex, you need a traditional if statement).

Re: Imba – A new programming language for the web

#79
post #75
post #58

Earlier quoted context omitted.

Mithril author here. It does appear to have a React-like engine here: https://github.com/somebee/imba/blob/master/src/imba/dom.sta... , but from a quick glance, I can't tell if the quality of the engine is any good (e.g. whether it supports lifecycle methods, efficient sorts, jQuery plugins, etc) because there are no docs and I don't really have time to read the whole codebase right now. Same goes for the speed claim…

> The lack of docs is a showstopper for me, however. That's a fair criticism. We know that docs are severely lacking. But at one point you'll have to release it. The reason it's been private for all these years is because there's always been just one more thing to fix. And this is just an open-source project. We just think this is a cool technology and want to share it with the rest of the community. > Same goes for…

Hi, just wanted to clarify I'm not trying to badmouth, just pointing some things that weren't clear to me (as someone who would be qualified to evaluate the quality of a React-like framework). Lack of docs aside, it does look like a nice project :)

> requestAnimationFrame isn't used in this demo

Interesting. Gonna look into the project more when I get a chance then.

jQuery plugins, from my own experience, are quite naughty. Modals, tooltips and drag-n-drop things are examples of things naive people might try to throw at the system and wonder why things get wonky.

Post reply on HN