This seems like bit of a short sighted move not that I disagree with it. Project Jigsaw which will be a big part of Java 9 aims to make the JVM more modular which will reduce the memory footprint substantially. Personally I would like to see a version of Clojure that targets this JVM specifically and abandons backwards compatibility. Leaving the JVM means you abandon the decade of libraries many of which you simply c…
In fact JVM is pretty fast. If you run a simple java app without dependencies and only displaying "Hello world" it will run in about 1s on modern hardware. The problem with Clojure is AFAIR related to parsing and loading a big number of namespaces which is quite slow.
Pixie: A sweet Clojure-ish language
21–30 of 109 posts
Re: Pixie: A sweet Clojure-ish language
#22Dynamic typing and parentheses are what keep me away from Clojure or Lisp like languages. How can I get over them?
Clojure:
(defn blub-extra [a b]
(blub (inc a) (inc b)))
8 parens + 2 bracketsScala:
def blubExtra(a: Int, b: Int): Int {
blub(inc(a), inc(b))
}
8 parens + 2 bracesJava:
Integer blubExtra(Integer a, Integer b) {
return blub(inc(a), inc(b));
}
8 parens + 2 bracesRuby:
def blubExtra(a, b)
blub(inc(a), inc(b))
end
8 parensPython:
def blubExtra(a, b):
return blub(inc(a), inc(b))
8 parens, one colonC:
int blubExtra(int a, int b) {
return blub(inc(a), inc(b));
}
8 parens + 2 bracesIt's roughly the same numbers of brackets (or equivalent) in Clojure, Scala, C and Java. A bit less in Python and Ruby.
Re: Pixie: A sweet Clojure-ish language
#23Earlier quoted context omitted.
> S-expressions are uniform in that they all look the same way. If you treat the language as a user interface to your computer, shouldn't things that do different things have different appearances, to help you distinguish them at a glance?
The braces become "invisible" after some training. Different elements of the program are distingishable. "+" is different from "if", which is different from "42".
Like you say, with training, the differences are probably not that big a deal, but I don't think they are something to completely ignore, either.
Re: Pixie: A sweet Clojure-ish language
#24I want to see a clojure clone embedded as a Go scripting language. The immutability means that the interpreter would be mostly threadsafe, and thus would support goroutines well.
Embedding an immutable language in a mutable one is a recipe for awkwardness - how would you expose host-language things to the inner language? Better to do it the other way around - mutable scripting language embedded inside immutable host.
Re: Pixie: A sweet Clojure-ish language
#25Dynamic typing and parentheses are what keep me away from Clojure or Lisp like languages. How can I get over them?
In most ways I care about, Clojure is actually safer than C#. Now, if you're coming from an ML HM language, sure, you'll be taking a step back perhaps.
Re: Pixie: A sweet Clojure-ish language
#26Earlier quoted context omitted.
If you truly have been shunning Lisps because of parentheses I can only tell you that it will start to make sense once you see that they're just lists and that the fact that everything (including your code) is some variation of a list means that you are now (sometimes in the background) able to modify everything as if it was a list. S-expressions are uniform in that they all look the same way. This means you have one…
Lisp's super power (homoiconicity) comes at a trade-off of reduced discriminability. A good syntax highlighter and well-indented code (like you provided) reverses this effect considerably, but imho, it still takes a lot of getting used to for beginners. In any case, the bigger part of the being productive in a codebase is to figure out how it encodes the domain, what idioms and patterns are favoured etc. So sometimes…
When you compare Clojure to other lisps, I think you'd agree it's more discriminable, given the plethora of literals that dont use parenthesis: vectors [1 2 3] sets #{1 2 3} maps {:key "value" :name "Bryan"}
Re: Pixie: A sweet Clojure-ish language
#27Dynamic typing and parentheses are what keep me away from Clojure or Lisp like languages. How can I get over them?
I think Clojure is actually a lot safer by default than most people expect for a Lisp. Check out this comparison I wrote up between C#(or Java), F#, Clojure, and JavaScript on common edge case safety. http://deliberate-software.com/programming-language-safety-a... In most ways I care about, Clojure is actually safer than C#. Now, if you're coming from an ML HM language, sure, you'll be taking a step back perhaps.
Re: Pixie: A sweet Clojure-ish language
#28Earlier quoted context omitted.
In fact JVM is pretty fast. If you run a simple java app without dependencies and only displaying "Hello world" it will run in about 1s on modern hardware. The problem with Clojure is AFAIR related to parsing and loading a big number of namespaces which is quite slow.
1s to print hello world is an awful lot I would like to point out.
As an aside - I was trying to reduce -Xmx to improve HelloWorld startup (lol idk...) and Xmx smaller then 1024k and it couldn't start up with less then 1024k so there's that.
On my windows computer (also I barely know what I'm doing so probably even timing it wrong).
[Mon Mar 09 03:22:31 zebra@ZEBRA:~ ]
$ time a.exe
Hello, world
real 0m0.098s
user 0m0.015s
sys 0m0.015s
[Mon Mar 09 03:22:34 zebra@ZEBRA:~ ]
$ time java Hello
Hello, world!
real 0m0.285s
user 0m0.000s
sys 0m0.031sRe: Pixie: A sweet Clojure-ish language
#29This seems like bit of a short sighted move not that I disagree with it. Project Jigsaw which will be a big part of Java 9 aims to make the JVM more modular which will reduce the memory footprint substantially. Personally I would like to see a version of Clojure that targets this JVM specifically and abandons backwards compatibility. Leaving the JVM means you abandon the decade of libraries many of which you simply c…
Re: Pixie: A sweet Clojure-ish language
#30Dynamic typing and parentheses are what keep me away from Clojure or Lisp like languages. How can I get over them?
There aren't many languages that have radically fewer parentheses than Clojure / LISP. Clojure: (defn blub-extra [a b] (blub (inc a) (inc b))) 8 parens + 2 brackets Scala: def blubExtra(a: Int, b: Int): Int { blub(inc(a), inc(b)) } 8 parens + 2 braces Java: Integer blubExtra(Integer a, Integer b) { return blub(inc(a), inc(b)); } 8 parens + 2 braces Ruby: def blubExtra(a, b) blub(inc(a), inc(b)) end 8 parens Python: d…