5 ms·
How Kal Compiles Itself
- lmartel 13y agoThis is definitely one of the coolest "Show HN"-style projects I've seen in a while. Great work!
- jashkenas 13y agoAs CoffeeScript also went through this same process, bootstrapping itself away from an original Ruby-based compiler (at this moment: https://github.com/jashkenas/coffee-script/commit/6446e0004c6e53cf909b300ebb12a934ccb33eb6 https://github.com/jashkenas/coffee-script/commit/6446e0004c...), Kal is now in some sense "two self-hosted steps" away from a "normal" language. That's pretty neat. GorillaScript (here: https://github.com/ckknight/gorillascript/tree/master/src https://github.com/ckknight/gorillascript/tree/master/src), Coco (here: https://github.com/gkz/LiveScript/tree/master/src https://github.com/gkz/LiveScript/tree/master/src) et al, are also implemented in themselves. I hope that this trend of compile-to-JS languages tending to self-host continues.
- drivebyacct2 13y agoMy understanding is that many self hosting compilers do something similar to bootstrap, etc. Very cool to get an inside look despite my other feelings of Kal.
- aa0 13y agoWhile it may be cool that Kal compiles itself, unless there is a source tree for the Kal binaries themselves, there is a indubitably huge issue of trust with distributing binaries. Relevant: http://cm.bell-labs.com/who/ken/trust.html http://cm.bell-labs.com/who/ken/trust.html
- spicyj 13y agoThe article links to that very page: > anarbi posted a great [link] about how compilers can contain a memory of things that are no longer in the code.
- vorg 13y agoI'm wondering what Kal's license is? I'm especially wondering if source written in the language itself qualifies as open source under the terms of any/some/most/all of the Free and Open Source licenses, or if the source of every version ever used to compile another version must be made available?
- fleitz 13y agoAll self-hosted GPL compilers have this 'problem'... The output of the compiler under the GPL can be licensed however you like.
- _random_ 13y agoA word of warning: the name 'Kal' will be funny to russian-speaking devs. In case you care.
- teebrz 13y agoSure, it would be a poor name for a new soda you plan to market in Russian-speaking countries; but probably not really worth mentioning here. I'm sure you realize, but lots of Russian words/phrases sound funny (or obscene) in English too - this is true of every language and vice versa. Naming things is hard enough already without trying to cover what it might sound like in every major language.
- deleted 13y ago[deleted]
- solomatov 13y agoKal means feces in Russian. >Naming things is hard enough already without trying to cover what it might sound like in every major language. IMO, when you give a name to internationally used thing, this should be taken care of. I.e. name shouldn't sound funny obscene in any of the major languages.
- teebrz 13y agoI think most Russian-speaking programmers are intelligent enough to understand it's a foreign name, especially since it's written as "kal" and not "кал". > I.e. name shouldn't sound funny obscene in any of the major languages. My point is that this is probably more difficult than you realize. It's also pointless; if you're the maker of a consumer product (like a soda) and you expect to market it in Russian-speaking countries, then of course you need to watch out for such things. Something like this which is only incidentally used by a small portion of technically literate Russian speakers - it's not really worth bothering with.
- rzimmerman 13y agoYeah, that's kind of a shame. I'm not planning on changing it though. I figure most russian devs will have a sense of humor about it. I guess with a word that short, most languages are bound to have a meaning for it. I chose it because in Hebrew it means simple/easy/BASIC.
- callesgg 13y agoSo in essense it dosen't, not more than any other language atleast. It originaly compiles from coffescript. It's a point of view thing.
- norswap 13y agoIt does. Coffeescript is not involved at any point in the current compilation process. It did not originally however.
- teleological 13y ago"wait for" and "for parallel" seem useful. Are they inspired by constructs in other languages, or do they have analogs in other languages?
- rzimmerman 13y ago"wait for" turns out to be somewhat analogous to the upcoming "yield" statement in ECMAScript 6 as well as .NET patterns for async code. "for parallel" must exist somewhere (it almost looks like functional programming). I actually added it as an afterthought when I decided "wait for" ought to work inside of loops. It uses the same mechanism as async.js's "map".
- octo_t 13y agoFortress and Scala have similar concepts (0 to 10).par.foreach(expensiveOp)
- qu4z-2 13y agoC# has range.AsParallel().Select(expensiveOp); Which is hilariously verbose, and map is called select. But it's nice to have...
- anaphor 13y agoWhy isn't anyone doing languages that compile to a trampolined form of JS? It would kill two birds with one stone: you get to write recursive code without wasting memory, and you can easily implement a lightweight thread scheduler. It seems like people are just picking the low hanging fruit, i.e. "JS syntax is ugly, let's implement a desugarer". I haven't seen many people try to change the semantics of JS much. maybe Whalesong or something, but nobody is using that.
- kevingadd 13y agoOne reason is that performance would be miserable. Most current JS runtimes aren't very good at optimizing that kind of code, and it actually uses quite a bit of extra memory.