Linj

Jun. 2nd, 2006 10:29 am
gusl: (Default)
[personal profile] gusl
Linj is brilliant! It's a Lisp dialect for translating into Java and it produces readable, editable code:

from the Linj Manual:
Finally, and because a language is not only syntax and semantics but also pragmatics, Linj also tries to translate between Common Lisp conventions and Java conventions.


Even the language manual is quite entertaining, at least in the beginning. I like the jokes with obfuscated code.

Linj, like CL, saves you from explicitly declaring types. When translating to Java, it infers what the type should be.

(no subject)

Date: 2006-06-02 02:39 pm (UTC)
From: [identity profile] combinator.livejournal.com
Linj doesn't do tail recursion. I think that would be a good feature to add, to automatically compile a tail recursive function to an iterative one.

(no subject)

Date: 2006-06-02 03:31 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
does Java optimize tail-calls?
If not, then Linj couldn´t anyway since it´s interpreted into Java.
If so, then Java will do it when it times comes.

It´s just not Linj´s responsibility to compiler optimizations, is it? Efficiency-aware translation is a good thing though.

(no subject)

Date: 2006-06-03 07:32 am (UTC)
From: [identity profile] combinator.livejournal.com
I am not a Linjer, I just read your link. In fact, I am not a Lisper. I have programmed in ML dialects and I have some respect for the language (but wish that the compilers gave better error messages).

Java does not optimize tail-calls, but it emphasizes an imperative paradigm. Since Linj emphasizes a functional paradigm, it should optimize tail calls. Linj compiles to Java, and therefore it should compile to the most efficient readable Java that it can.

However, your point is still a good one, that Java should optimize them as well. I think the reason why so few compilers perform this optimization is that only academics are concerned with tail recursive functions. Everyone else just programs imperatively in their imperative languages. Recursion is only widely used to traverse log-depth structures.

Profile

gusl: (Default)
gusl

December 2016

S M T W T F S
    123
45678910
11121314151617
18 192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags