Live data from Hacker News

Imba – A new programming language for the web

imba.io

81–90 of 180 posts

Re: Imba – A new programming language for the web

#81

Earlier quoted context omitted.

Hi. We actually do a different kind of diffing - which turns out to be substantially faster than React: http://somebee.github.io/todomvc-render-benchmark/index.html . The language has just been released, it is still very lacking when it comes to documentation. Working on it :)

Can you give some details about Imba's diffing?

What part of the diffing?

Imba only uses `===` for diffing. If you want Imba to re-use a DOM node, you must use the same tag object. Imba provides syntax for caching nodes as properties on the current object.

For instance, in order to re-use DOM nodes in a for loop you do this:

    for event in @events
      
The loop body compiles down to:

    (this['_' + event.id()] = this['_' + event.id()] || t$('event')).setName(event.name()).end()
The next time you render the view, Imba will find the tag objects that have been reordered (using `===`) and move them to the right place.

One thing to be aware of is that Imba doesn't automatically remove the cache for you, because we've found that it's tricky to determine when you actually want to purge it. For instance:

    if mouseOver
      
    else
      
Just because `mouseOver` becomes true for one frame doesn't mean you want the ``-tag to be purged from the cached and removed. Keeping it around is nice for performance and convenience (e.g. state, jQuery plugins).

In practice it turns out you want to purge whole pages/sections at the same time, which is way friendlier for the garbage collector as well.

Re: Imba – A new programming language for the web

#82
post #76

Earlier quoted context omitted.

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.

You should check out https://readme.io for getting started on docs – they offer the platform free to open source projects.

Re: Imba – A new programming language for the web

#83
post #78

Earlier quoted context omitted.

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 co…

Ah, that's interesting – they become expression modifiers instead.

  x = (:false if true)
  => :false
  
  x = (:false if false)
  => nil
Any other if statement does appear to be treated as a value:

  x = if true then 5 else 10 end
  => 5

Re: Imba – A new programming language for the web

#84
post #37

Earlier quoted context omitted.

Imba includes syntax for tags (scroll down to "Tags"), virtual DOM diffing, event handling (with touch support). Yes, React is not a language in itself, but there's quite big overlap in what Imba does and what React+JSX does. You build UI components like this: tag event event.title "Happening on {event.dateString}"

No. Read what I wrote again. You just wrote a template. That's like JSX. You ALSO need a library to do the virtaul dom stuff and/or data binding to write an application. React. !=. JSX. What you have here is a programming language that compiles to javascript and has an inbuilt templating language. So does ES6; `${hi}`. That's a fundamental building block, not a replacement for a high level framework , like react.

I can only conclude that you're so focused on aggressively dismissing this person's work, in the typical HN fashion, that you didn't actually read the comment you responded to, or any of their other responses throughout this thread.

You say:

>You ALSO need a library to do the virtaul dom stuff and/or data binding to write an application.

OP says:

>Imba includes syntax for tags (scroll down to "Tags"), virtual DOM diffing, event handling (with touch support).

>Although Imba was started before React it should be noted that it didn't include virtual diffing until React showed that it worked.

Re: Imba – A new programming language for the web

#87
I for once would appreciate it if Ruby programmers would stop trying to avoid writing JavaScript by writing their own JS-based implementation of Ruby.

With ES6 and Babel this "new programming language" provides nothing interesting other than making your code look more like Ruby.

Re: Imba – A new programming language for the web

#89

This is good! Now take away all the unnecessary references to that pile of junk that is ruby and it'll be great.

This tool is forked from Coffeescript, which is deliberately designed to resemble Ruby. There's a good reason for that – some aspects of Ruby's syntax are well-loved. It might be more effective for you to use your time understanding why these aspects are important, since you apparently feel this project is good, and less time being a bit of a dick about it.

> some aspects of Ruby's syntax are well-loved.

By Ruby programmers. Why is it that Ruby programmers are incapable of imagining anyone doesn't love Ruby?

This isn't a universal truth for all programmers either. I've met plenty Java programmers willing to admit the shortcomings of Java, I've met PHP programmers painfully aware of the language's warts, I've even met Python programmers willing to admit Python's limitations. I've yet to meet a Ruby programmer who doesn't believe that Ruby is the best thing since sliced Jesus.

Re: Imba – A new programming language for the web

#90
We've been using this coffeescript/jsx project throughout our codebase: https://github.com/jsdf/coffee-react

Similar idea but just ads JSX tags to Coffeescript (cjsx).

Only ergonomics problem is that the syntax highlighting sometimes breaks on single quotes used within the XML tags so you end up having to do something like `

{"you're fired"}

` so that it doesn't mess up the highlighting in your whole file.
Post reply on HN