
Julia 0.2 released - StefanKarpinski
https://github.com/JuliaLang/julia/blob/05c6461b55d9a66f05ead24926f5ee062b920d6b/NEWS.md
======
andrewcooke
julia seems to be positioned as a kind of matlab / r replacement. but i'm
finding it works very well as a faster python, for the kind of programs i am
writing in my free time (learning about / analysing block ciphers, most
recently).

its big idea is multiple dispatch, like clos (oo-lisp) multimethods. where you
would define an "underscores" method in python (ie to extend the language for
a new class), in julia you define appropriate functions for that type - the
cute thing being that the new type doesn't have to be the first parameter.

so, for example, the equivalent of

    
    
        class Foo:
            def __repr__(self):
                ...
    

would be

    
    
        function show(io, f::Foo)
            ...
        end
    

and the end result is something that has more of a FP flavor than python. it's
very appealing.

if you're looking for a "dynamic scripting" language that takes some of the
good bits from static typing, and has decent performance, it's worth a try.

~~~
PuercoPop
I think another big advantage of CLOS that Julia took is that you can dispatch
on the type of not just the first argument but on the combination of the types
of all the arguments

~~~
StefanKarpinski
Multiple dispatch is very powerful paradigm and Julia takes it a good bit
further even than CLOS. There's a good comparison of Julia and CLOS in terms
of parametric types and dispatch in Julia's Wikipedia entry:

[https://en.wikipedia.org/wiki/Julia_(programming_language)#L...](https://en.wikipedia.org/wiki/Julia_\(programming_language\)#Language_features)

It also compares with Dylan and Fortress, which are the other major non-
research multiple dispatch languages. The unique combination of features that
Julia has is

1\. a fully dynamic type system (code with type annotations is still
dynamically typed)

2\. functions are all generic by default, including all the built-ins and
operators

3\. support for parametric types that you can dispatch on.

This combination of features working smoothly together turns out to be very
powerful, especially when designed so that you don't have to talk about types
except when you want to.

~~~
rcthompson
> Dylan and Fortress, which are the other major non-research multiple dispatch
> languages

What about R with S4 classes?

~~~
StefanKarpinski
Fair point, although R's multiple dispatch barely counts as a language feature
at all, but is really more of a standard add-on library (read on). All S4 is
doing is using a hash table keyed by method signatures to look up which
function body to call. You don't even need any syntactic support since
"defining a generic function" is just a matter of defining a function that
does a hash lookup and then applies that function to its arguments. R doesn't
provide any syntactic support for adding methods to generics – you literally
have to give it a vector of strings of argument class names. Since you can do
all of this in any language – even C – it's arguable that multiple dispatch
isn't really part of "the R language" at all, but rather "the R system"
happens to ship with a standard implementation of hash-based multiple dispatch
and a few of the built-in function like "show" and "plot" are defined using
it.

Due to not being a deep language feature, S4 lacks some crucial abilities. It
doesn't support any sort of type hierarchy besides the special "ANY" class.
Without the ability to define a type hierarchy and program to abstract types,
most of the power of multiple dispatch evaporates. Even though it is
technically an implementation detail, I've found that performance is a
critical feature for multiple dispatch to really come into its own. R's S4
dispatch has been described as "slower than S3" [1] – and S3 dispatch is not
exactly fast. Unless really basic things like + and array indexing can be
generic and usably fast, you're not really cooking with gas.

[1]
[http://www.r-project.org/conferences/useR-2004/Keynotes/Leis...](http://www.r-project.org/conferences/useR-2004/Keynotes/Leisch.pdf)

~~~
rcthompson
Thanks for the explanation. What do you mean by "It doesn't support any sort
of type hierarchy"? I've contributed to a package that defines some S4 methods
on a base class and relies on that implementation being called on derived
classes as well.

~~~
StefanKarpinski
This may be a misunderstanding on my part because I am by no means an R expert
(I've done a fair amount of stats work in R, but no library development). Can
you add a method for base class "Foo" which will automatically apply to "Bar"
which is a subtype of "Foo"?

~~~
rcthompson
As far as I know, yes, this works just fine. We rely on this in the
BiocParallel package in Bioconductor.

------
StefanKarpinski
To quote the mailing list announcement [1]:

> We will be supporting a 0.2 line of releases that maintains compatibility
> with 0.2 with minimally invasive bug fixes, so this is a good time to switch
> to 0.2 for production systems.

This release was a fairly long time coming from the previous 0.1 stable
release. If you've been considering trying Julia out but were worried that it
was moving too fast (it's been moving pretty fast), this is a good time to try
it out. Not only will the 0.2 release line be supported with minimally
invasive bugfixes, but also the 0.3 release is going to largely consist of
performance improvements.

[1] [https://groups.google.com/forum/#!topic/julia-
users/-lh_g9eH...](https://groups.google.com/forum/#!topic/julia-
users/-lh_g9eH4bk)

------
mlubin
For anyone interested in using Julia for numerical optimization/mathematical
programming, see [http://juliaopt.org/](http://juliaopt.org/).

We have pure-Julia implementations of standard unconstrained methods [1] as
well as a domain-specific modeling language [2] for (integer) linear
programming with links to open-source and commercial solvers. Julia's
performance and advanced language features such as metaprogramming really make
it a great language for optimization [3].

[1]
[https://github.com/JuliaOpt/Optim.jl](https://github.com/JuliaOpt/Optim.jl)

[2] [https://github.com/JuliaOpt/JuMP.jl](https://github.com/JuliaOpt/JuMP.jl)

[3]
[http://www.mit.edu/~mlubin/juliacomputing.pdf](http://www.mit.edu/~mlubin/juliacomputing.pdf)

~~~
idunning
Here are the slides for a recent talk we gave about JuliaOpt:

[https://docs.google.com/presentation/d/1FlHt245YxPXFwOHmxLYW...](https://docs.google.com/presentation/d/1FlHt245YxPXFwOHmxLYW1z5_QjdCYHVPjy5Zo12lx1I/edit?usp=sharing)

------
aleandros
I cannot express how much I want this project to succeed! Congratulations and
keep it going!

------
carreau
Congratulation to all of you, thrilled to see all the new improvement that
will arrive in next version !

------
rcthompson
I'd love to switch to Julia, but I rely on a lot of packages that are only
available in R (e.g. lots from
[http://bioconductor.org/](http://bioconductor.org/)). Is there any way to
call R code from Julia?

~~~
pygy_
[https://github.com/lgautier/Rif.jl](https://github.com/lgautier/Rif.jl) is
what you're after.

The code to call R is a bit ugly, but it looks straightforward to learn.

------
RivieraKid
After using it for smaller projects, one of the few things I don't like is
multidimensional arrays. I would prefer if only arrays of arrays were possible
and had some syntax sugar.

Edit: And perhaps some special treatment by the compiler for optimization. I
find multi-d arrays counter-intuitive and clumsy on some situations. Also,
currently I'm forced to write ugly code like array[x,y][i].

~~~
StefanKarpinski
You can of course use arrays of arrays if you like, but multidimensional
arrays are indispensable for numerical work, especially linear algebra –
matrices are 2D arrays after all. When doing numerical work in C, for example,
you have to simulate multidimensional arrays by doing your own index
calculations to translate back and forth between linear indexing and N-d
indexing. Having language support for this is a must if you want to target
numerical programming.

~~~
zwegner
I'm confused about your reference to C. C has multidimensional arrays, and all
the elements are laid out contiguously in memory. No index calculations are
needed, it's all done by the array indexing operation.

If you have this code:

    
    
        int a[10][10];

then:

    
    
        &a[x][y] == ((char *)a + x * sizeof(a[0]) + y * sizeof(a[0][0]))

where sizeof(a[0]) is == sizeof(int) * 10.

quick edit: added a (char *) cast so the arithmetic doesn't multiply by
sizeof(int) again

~~~
StefanKarpinski
Right, I should have clarified. That works for statically allocated arrays but
not for dynamically allocated ones. Since matrix dimensions are generally not
known ahead of time, in real programs you almost always end up needing to
simulate multiple indices using explicit index arithmetic.

------
Derbasti
Does anyone know what the state of plotting is in Julia? I couldn't really
find any convincing examples for that. For many applications, plotting really
is a big requirement.

That said, I look forward to a future where Julia will take over many use
cases that are served by Matlab right now.

~~~
ViralBShah
Although there is no definitive plotting option, we are exploring a number of
avenues. See:

[http://julialang.org/downloads/](http://julialang.org/downloads/)

With the IPython Notebook and Julia, you can use Gadfly to produce plots right
in the notebook without any further installation.

------
dodyg
How suitable is it to use for mainstream programming (building web app, etc)

~~~
idunning
That line of development hasn't been pushed very hard yet, but the
fundamentals are good. For a example, check out
[http://iaindunning.com/2013/sudoku-as-a-
service.html](http://iaindunning.com/2013/sudoku-as-a-service.html) where I
make a nice little webservice.

~~~
ViralBShah
Also if you look through the package list, you will see people doing all kinds
of stuff with Julia.

[http://docs.julialang.org/en/latest/packages/packagelist/](http://docs.julialang.org/en/latest/packages/packagelist/)

------
jamesjporter
Congrats on the release to everyone involved; very excited about the future!

------
idProQuo
This is a dumb question, but is Julia named after anyone in particular?

~~~
grimgrin
From an interview:

InfoWold: Why the name, Julia?

Karpinski: That's everybody's favorite question. There's no good reason,
really. It just seemed like a pretty name.

[http://www.infoworld.com/d/application-development/new-
julia...](http://www.infoworld.com/d/application-development/new-julia-
language-seeks-be-the-c-scientists-190818?page=0,1)

~~~
jnbiche
Really?? I was sure it was for Gaston Julia.

~~~
vjoel
Or Julia Robinson:
[http://en.wikipedia.org/wiki/Julia_Robinson](http://en.wikipedia.org/wiki/Julia_Robinson)

