User: Password:
|
|
Subscribe / Log in / New account

A look at two new languages: Vala and Clojure

A look at two new languages: Vala and Clojure

Posted Jun 4, 2009 9:05 UTC (Thu) by rwmj (subscriber, #5474)
Parent article: A look at two new languages: Vala and Clojure

Vala is a bit of a lost opportunity.

It could have been a great step forward: type inference, non-intrusive static typing, ideas from functional languages, strong emphasis on safe programming practices ... All things which are needed by the free software community.

Instead we got a warmed-over C# clone with a syntax more verbose than Java, and none of the innovations in language design which have happened in the past decades.

Rich.


(Log in to post comments)

A look at two new languages: Vala and Clojure

Posted Jun 4, 2009 13:30 UTC (Thu) by walters (subscriber, #7396) [Link]

It's not clear to me that type inference is a huge win for an imperative OO language in general. The general imperative/OO versus FP debate aside, in the specific domain Vala originated from (GUI programming for GNOME), OO languages are just a much more natural fit than FP, since the GUI is a massive chunk of state. Certainly all of the libraries are heavily OO and imperative.

Not clear what you mean by "safe programming"? Memory safety/garbage collection? In that case true, but it was a design goal of Vala to be independent of higher level runtimes and thus usable for lower level libraries in the stack.

A look at two new languages: Vala and Clojure

Posted Jun 4, 2009 13:54 UTC (Thu) by rwmj (subscriber, #5474) [Link]

Type inference is possible with OO languages. Ironically recent versions of C# have a rather pathetic form of type inference. Anyway, OCaml has type inference, duck typing, strong typing and excellent OO.

GUI toolkits can be designed on pure functional principles, although that wasn't what I was advocating. Look up Functional Reactive Programming. There are various toolkits for Haskell implementing these techniques.

Safety is always a good thing to build into modern languages, not just because no one wants their programs to crash so much, but because in some cases it really matters - errors and inaccuracies in GUI programs can have all sorts of effects from wasted time right up to death. Languages should be designed to reduce programmer mistakes. Garbage collection is one of many techniques in this area. Others include: design contracts, modularity, strong typing, phantom types, test-driven development.

Unfortunately all of this research seems to have passed over the heads of the developers of Vala.

A look at two new languages: Vala and Clojure

Posted Jun 4, 2009 14:11 UTC (Thu) by walters (subscriber, #7396) [Link]

Type inference is possible with OO languages. Ironically recent versions of C# have a rather pathetic form of type inference.
Sure (and what is ironic about it?), but what I am claiming it that it's not overly useful in a heavily imperative/OO context, given that C++/Java/C# programmers have gone many years without it. Eclipse does a good enough job at filling out generics right now for me.
Unfortunately all of this research seems to have passed over the heads of the developers of Vala.

You missed by point that garbage collection would have been incompatible with a key Vala design goal. It didn't "pass over their head".

We can't use GC in the lower level components of the GNOME stack because then if you wanted to use a higher level language (like OCaml!) on them, you'd have two different garbage collectors in the same process which is a recipe for disaster.

design contracts, modularity, strong typing, phantom types, test-driven development.

Vala definitely has modularity and strong typing. I'd argue test-driven development is not a language feature but a cultural feature. I'm not familiar with phantom types.

Anyways, you seem to be essentially saying that because Vala isn't OCaml it must be broken, when there are actual engineering tradeoffs that you're not recognizing.

A look at two new languages: Vala and Clojure

Posted Jun 4, 2009 14:13 UTC (Thu) by rwmj (subscriber, #5474) [Link]

You really should read this essay!

Are you sure all the language developers are mad?

Posted Jun 4, 2009 19:28 UTC (Thu) by khim (subscriber, #9252) [Link]

Sure (and what is ironic about it?), but what I am claiming it that it's not overly useful in a heavily imperative/OO context, given that C++/Java/C# programmers have gone many years without it.

Then why it's added to C#, C++ (gcc 4.4 at least does have it), etc? Are you sure developers do it because they all are mad?

Eclipse does a good enough job at filling out generics right now for me.

Yup. Basically you are using type inference - just implemented not in compiler as sane people are doing but in editor. And it produces tons of useless clutter because it's implemented in wrong place.

We can't use GC in the lower level components of the GNOME stack because then if you wanted to use a higher level language (like OCaml!) on them, you'd have two different garbage collectors in the same process which is a recipe for disaster.

Why is it a disaster? You can combine compiled Java code (GCJ) and Scheme code (Guile) in a single process - and everything "just works". Sure, it's not exactly super-fast (you are scanning some small regions of memory twice), but no other problems are shown...

Anyways, you seem to be essentially saying that because Vala isn't OCaml it must be broken, when there are actual engineering tradeoffs that you're not recognizing.

Nope. If you want to see the language designed around existing OO-system, but which is done right - take look on Groovy. It's not perfect (no language is perfect) but it adds a lot of usefull features to Java while reusing the same JVM. Sure, JVM does have richer set of features if you compare it with GLib/GObject, but still the Vala is pretty pathetic language.

Are you sure all the language developers are mad?

Posted Jun 5, 2009 18:53 UTC (Fri) by amaranth (subscriber, #57456) [Link]

Vala does have some type inference, btw. Just like C#, it supports things like this:

var reader = new Reader ();

A look at two new languages: Vala and Clojure

Posted Jun 4, 2009 14:01 UTC (Thu) by alankila (guest, #47141) [Link]

I'd like to say that type inference makes it somewhat possible to write code without an IDE. Static languages like C# and Java are chock full of classes, and you'd be dipping into the manuals all the time to figure out which returns what and so on.

With a C# keyword like "var" you can make the type information implicit, which makes it easier to write and change the code. Plus there's just something about:

Reader reader = new Reader()

collapsing to:

var reader = new Reader()

that makes the code much more readable to me. It's removing the type information that looks and feels like noise to me.

Then again, when there's a typo somewhere and the compiler can't figure out what the implicit type stands for, the errors that result are almost incomprehensible. I'm hoping Mono people can fix the parser to abort earlier instead of filling "var" with "object" and proceeding until it crashes and burns 5 lines later with missing methods and wrong types for calls etc. Usually the first thing to debug problems like this is to add some type information back so you'll pĆ­npoint the line where it goes wrong.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds