Live data from Hacker News

Pixie: A sweet Clojure-ish language

blog.goodstuff.im

21–30 of 109 posts

Re: Pixie: A sweet Clojure-ish language

#21

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.

1s to print hello world is an awful lot I would like to point out.

Re: Pixie: A sweet Clojure-ish language

#22
post #4

Dynamic 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:

    def blubExtra(a, b):
        return blub(inc(a), inc(b))
8 parens, one colon

C:

    int blubExtra(int a, int b) {
        return blub(inc(a), inc(b));
    }
8 parens + 2 braces

It'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

#23
post #14

Earlier 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".

It's all about people, so there are likely not cut and dried answers, but I know I have always found C style code a bit easier to read than Lisp style code. Part of this may be due to other conventions, such as larger indents in C code.

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

#24
post #18

I 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.

Clojure is an immutable language built on top of mutable hosts. Interop is handled beautifully. A go hosted Clojure (gojure?) would probably be fine.

Re: Pixie: A sweet Clojure-ish language

#25
post #4

Dynamic 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

#26
post #8

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

I disagree with regard to Clojure. IME, the fact that it's a lisp doesn't seem as hard for noobs to grasp as immutability by default, or pickup up the functional programming mindset. We usually go for folks who use Emacs, so they may already have an indoctrination.

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

#27
post #4

Dynamic 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.

Clojure is horribly unsafe. I spent a year writing Clojure and half the time we were fixing bugs where someone had wrapped a map in another map or changed the shape of a data structure. For all that's worth, I'd rather use Javascript. To add insult to injury (the amount of wasted time on something that could be easily checked by a compiler and a sane type system) there's all the bad habits you acquire and the general lack of confidence in your code, which took a good six months after that to cure. I'm sticking with types now, thank you very much...

Re: Pixie: A sweet Clojure-ish language

#28
post #21

Earlier 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.

Upvoted you because I agree. JVM has many strong points but I don't think anyone is disputing that startup time is a weakness. I've used some java tools that you invoke from a command line and I'm always slightly annoyed by how slow they are.

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.031s

Re: Pixie: A sweet Clojure-ish language

#29

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…

It can call into C libraries so there is a whole other ecosystem available to it.

Re: Pixie: A sweet Clojure-ish language

#30
post #4

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

I think it's the positioning of them that makes them stand out to people, plus the fact that they tend to bunch up at the end of things.
Post reply on HN