What features will I miss in Julia?

Based on discussion here, that’s what I put in my .juliarc.jl file. The cost of the first plot is taken at launch.

using Plots
default(show = true, size=(1100,800)) # personal preference, not necessary for this trick
p = plot(1:10);Plots.close();

Of course, this means that firing up Julia now takes about 15sec to launch. But I much prefer to spend the 15s at launch as opposed to anxiously waiting to see my “new freshly-baked results that might shatter the scientific world… if only I could see the results NOW:wink:

5 Likes

There’s still #16467 (which prevents you to use workspace when using some packages) that is quite annoying, hopefully it gets fixed at some point. Thinking about it I should maybe evaluate all my code in a dummy package and then just use another one when I want a clean workspace.

Yes, putting code you develop in a module is something I strongly recommend. I haven’t used workspace in years…

2 Likes

Actually, after #265 was fixed, I found the opposite to be true. The reason is that my modules usually contain type definitions, and when reloading/replacing a module in the REPL, any data which was defined using the types of the original module will go into an “orphaned type” state so that all the module functions can no longer be applied to those types. This is true even if the type definition was not changed in the updated module.

To clarify what I mean, consider the following module in “Foos.jl”:

module Foos
type Foo; x::Int; end
f(foo::Foo) = foo.x + 1
end

And this REPL session (on 0.6.0-rc1):

julia> include("Foos.jl");

julia> foo = Foos.Foo(10)
Foos.Foo(10)

julia> Foos.f(foo)
11

julia> include("Foos.jl");
WARNING: replacing module Foos

# now foo has a type which is out of scope
julia> Foos.f(foo)
ERROR: MethodError: no method matching f(::Foos.Foo)
Closest candidates are:
  f(::Foos.Foo) at <redacted>/Foos.jl:3

(Also, the error message is maximally unhelpful.)

For this reason, I only put stable code (e.g. type definitions) into the module, but the functions which are under development, I put them into a seperate file outside of the module scope. Reloading this file will just update the function definitions, and avoids replacing the module. Once the function has stabilized, I put it in the module.

1 Like

RStudio has a number of really great features that I can only assume will also come to juno in time. Working with RMarkdown files is really seamless in RStudio; unless I’m mistaken, there’s no “knit” button in juno. I do think that Hadley Wickham is a shining star in the R world who really understands that programming is done by humans. For example, devtools is a really great package which I think has really accelerated development in the R ecosystem. I’ve been working on PackageGenerator.jl to make “batteries included” Julia packages, so we’re getting there (and there are a lot of really great packages working on literate programming, include documenter, weave, macrotools, etc). But I do think that everyone could learn some lessons from the Hadleyverse, including:

  1. Functions with full words separated by underscores (and in general, programming that follows natural language as closely as possible)
  2. Gearing everything towards absolute beginners (and being more friendly to people who ask stupid questions, as I often do)
  3. An emphasis on tooling and workflow over content
4 Likes

The suggested workflow atom-julia-client/workflow.md at master · JunoLab/atom-julia-client · GitHub actually suggests using an empty buffer rather than the console to develop code within the scope of a module. I always do that (with a ‘scratch.jl’ file), then just rerun the code up the point where I’m at to regenerate the state.

2 Likes

You find the R community more friendly towards beginners? I in contrast find the julia-community much more friendly and welcoming (to people who appear to be making an effort), though with a tendency to urge people to contribute rather than to request.

4 Likes

I think that @bramtayl was talking about the support forums for packages of Hadley. The corresponding mailing lists are quite friendly.

1 Like

Fair enough. Oh, by the way, there is markdown preview in Atom markdown-preview-plus. There is no such thing as JuliaMarkdown, though, of course - the rMarkdown feature of RStudio seems more intent on competing with something like Jupyter?

I would say that rmarkdown and Jupyter are quite different. Weave.jl (GitHub - JunoLab/Weave.jl: Scientific reports/literate programming for Julia) is the “JuliaMarkdown” that closely resembles rmarkdown. Would be nice if it was integrated with Juno. : )

2 Likes

Wouldn’t that really only be a question of a button that could run weave, save to a temporary html file, then render that file to an Atom pane?

1 Like

Seems so. Especially since the syntax highlighting is already implemented (language-weave). Very nice work from @mpastell and others!

2 Likes

There’s actually an open issue for this https://github.com/JunoLab/Juno.jl/issues/30

2 Likes

ClobberingReload.creload("modulename") doesn’t have that issue, because it reevaluates the code inside the module (as does Autoreload.jl and Atom) instead of creating a new module with new types .

Personally I find the whole workflow situation to be quite unsatisfying. I’ve been using Julia for 3 years and I’m still puzzled about the whole thing. Imagine explaining this to a new comer atom-julia-client/workflow.md at master · JunoLab/atom-julia-client · GitHub

The fact that you need external tooling is also a sign that something’s not ideal with the base language. Maybe it’s just a necessary evil and there’s not much do do about it, but it doesn’t feel so great currently.

8 Likes

I’ve been writing my code in a package, and putting my exploratory code in runtests.jl, then just running Pkg.test("mypkg") over and over. It runs fresh every time, so I can change anything, it goes pretty fast for small package (it gets cumbersome eventually). I also end up with way better test coverage this way. It still not ideal, but its easy and I understand it. Once the debugger is easier to use, I’m guessing that will solve most of my remaining complaints.

5 Likes

i miss data type definitions from Haskell , i.e.

data Foo = A Int | B Double | C

Really, really, very useful, and of course even more so when you have “case” to go along with it.

I expect I can get the same sort of functionality by using separate types and Union and typealias, but not nearly as elegant.

The good news is that even though julia doesn’t have “case” there is the match package which is quite nice !

For what it’s worth, “Julia has” and “there’s a package for” is pretty much the same in Julia, and that it a major strength. Practically nothing has to be in Base, other than what is there because it is handy.

6 Likes

I’ve seen than Weave is not updated since three years ago. And the same happens with Judo.jl.
Is there any alternative?

It was updated last month.

https://github.com/mpastell/Weave.jl