Imba – A new programming language for the web
11–20 of 180 posts
Re: Imba – A new programming language for the web
#12Re: Imba – A new programming language for the web
#13Re: Imba – A new programming language for the web
#14Having 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. I've been struggling to use React on teams with designers because small design changes can cause rather huge changes in how the code is structured.Other than that you can think about it as indentation based JavaScript with implicit method calling (`foo.bar = 123` calls the setter `setBar`) and saner handling of `this`.
Re: Imba – A new programming language for the web
#15I lot of these things are basically irrelevant if you use ES6/7.
Re: Imba – A new programming language for the web
#16Thank you for not saying "transpile".
Re: Imba – A new programming language for the web
#17"if Ruby and React had an indentation based lovechild, what would it look like?" Let me guess!... CoffeeScript?
- Implicit calling: `foo.bar` calls `foo.bar()` and `foo.bar = 123` calls `foo.setBar(123)`
- Objects have instance variables that's separate from the methods. Well, technically the instance variable `@bar` is just stored as a property with name `_bar` on the object.
- Variables must be declared with `var` and they correctly shadow previously defined variables.
- `do` provides a syntax sugar for the pattern "function as the last argument"
- Optional arguments work together with block parameters
def timeout(amount = 0, &cb)
cb(amount)
Compiles to: function timeout(amount,cb)
if(cb==undefined && typeof amount == 'function') cb = amount,amount = 0;
return cb(amount);
};
- `self` is a keyword which is a saner `this`, and instance variables are automatically looked up using `self`: def end
@client.on("end") do
@server.end
Compiles to: function end(){
var self=this;
return this._client.on("end",function() {
return self._server.end();
});
};Re: Imba – A new programming language for the web
#18Plus, I love the fact that the syntax looks Pythonic :)
Re: Imba – A new programming language for the web
#19Re: Imba – A new programming language for the web
#20Disclaimer: 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.…