# 1.0 annoyances and Matlab comparison

**URL:** <https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433>\
**Category:** Internals & Design\
**Created:** [March 1, 2018, 9:49pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433 "2018-03-01T21:49:56Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [March 2, 2018, 8:36am UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/22 "2018-03-02T08:36:31Z")

</div>

> [@Seif\_Shebl](#):
>
> using PackageX; using PackageY; using …, there are 1734 registered Julia packages at the time, MATLAB covers all science with 86 toolboxes without importing a single toolbox. How can one tell which package to use for which task and if a better alternative package exists for the same task without extensive search in the documentation of each package. Of course, I know the difference between open source projects built by many volunteers and highly paid proprietary software products. Tools that are easy to use, fully functional, and helping the user get the job done with minimal programming knowledge, will win at the end.

We probably need a better web server to search packages in both browser and terminal. But currently you can use [Julia.jl](https://github.com/svaksha/Julia.jl) and juliaobserver to find what you need. Besides, algorithms are developing, one cannot ensure a package is always the best choice.

> [@Seif\_Shebl](#):
>
> if a scientific computing language requires the user to write using LinearAlgebra, using Random, using FFTW, using SpecialFunctions, etc., what kind of scientific work can the language do by default?

As far as I know, making them to `Base` will cause slow start time and nobody wants to waste their time on things they don’t need. Only those who rely on language syntax, like `types`, `arrays`, etc. should be included as default. MATLAB is a product, not a language, therefore, they will allow you to install everything by default, and in fact, Julia has something similar: **JuliaPro**. Besides, you could probably find that a full-installed MATLAB has quite slow start time.

Besides `MATLAB` and `Fortran`, I believe Julia has learnt a lot from `Python`, another popular language in scientific programming. There is also no LinearAlg in Python’s stdlib, which is a nice feature. You should choose what you need and save some start time, which could be annoying when you try to run something frequently (like tests).

---

<div class="post-metadata">

**Author:** ![stephancb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephancb/32/14243_2.png) [@stephancb](https://discourse.julialang.org/u/stephancb)\
**Post date:** [March 2, 2018, 9:10am UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/23 "2018-03-02T09:10:32Z")

</div>

Also I have missed MATLAB’s automatic loading of non-default features when starting with Julia, where rather an explicit “using” of modules is required. Of course, Julia is here following many other languages, and MATLAB is more the exception.

How about adding an automatic loading/“using” of modules as a feature? For example

> shat = FFTW.fft(s)

would be equivalent to

> using FFTW  
> shat = FFTW.fft(s)

(only the first time when an FFTW function is used)?

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [March 2, 2018, 11:26am UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/24 "2018-03-02T11:26:58Z")

</div>

> [@stephancb](#):
>
> How about adding an automatic loading/“using” of modules as a feature?

You can already do that. In version 0.6 you can add that to the `.juliarc.jl` file. And, as I understand it, in version 0.7-\> the file will be called `startup.jl`, just like Matlab’s `startup.m` file.

---

<div class="post-metadata">

**Author:** ![stephancb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephancb/32/14243_2.png) [@stephancb](https://discourse.julialang.org/u/stephancb)\
**Post date:** [March 2, 2018, 12:58pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/25 "2018-03-02T12:58:08Z")

</div>

Yes, but it is not quite what I mean:

In MATLAB my `pathdef.m` includes for example `'/home/stephan/code/matlab/stuff:'`, and under this folder I put my own programs as well as stuff that others have written and kindly share (and MATLAB adds many more folders to the `pathdef` for its own “Base” plus toolboxes). Functions that I add under `.../stuff` will so be found and get automatically loaded when called, I don’t need to touch the `pathdef.m` any more.

In Julia I write my own modules and add packages, but need to add explicitely

> using …

whereever I need to use them (and modules needed really a lot I can add to `.juliarc.jl`). Not a big deal, but Julia could be a bit more friendly, if

> … Modx.funcy(…)

would effectively try to load `Modx` automatically, if not already loaded.

I vaguely remember there used to be an `Autoload.jl` package, that was perhaps providing something like this. It might well be that my suggestion is difficult to implement, colliding with Julia’s metaprogramming or other features that MATLAB does not have,

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 2, 2018, 1:42pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/26 "2018-03-02T13:42:33Z")

</div>

> [@Seif\_Shebl](#):
>
> the first test to look at when choosing a scientific language, is essentially testing looping. The test is especially unfair to MATLAB and Fortran

If all your performance-critical code only involves linear algebra and similar vectorized operations on large arrays, then the language performance is mostly[\*] irrelevant to you — all that matters is which BLAS library etcetera you link.

The cases where your own code’s performance matters are those where you have to write your _own_ “inner loop” code. This, therefore, is the only situation worth benchmarking when comparing languages for performance.

(And if you do enough scientific/technical computing, you will eventually run into a case where someone hasn’t written the critical code for you already. In Matlab or Python, this means dropping down to a lower-level language via mex, Cython, etc.)

[\*] Caveat: Even if your problem vectorizes well, writing your own specialized code can still sometimes be faster than composing many generic vectorized operations. [More Dots: Syntactic Loop Fusion in Julia](https://julialang.org/blog/2017/01/moredots)

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [March 2, 2018, 1:49pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/27 "2018-03-02T13:49:42Z")

</div>

I am normally a Matlab user, and I don’t really see a functional difference between adding paths in startup.m vs directly editing the path. Actually, I think adding all those paths inside startup.m is more convenient.

In other words, I don’t think there is any missing functionality in Julia in that regard. If, in Matlab, you want to use some code, you somehow need to load it, by adding it to the path, and you can equally well achieve that in an automatic way by editing `.juliarc.jl/startup.jl`.

> [@stephancb](#):
>
> but Julia could be a bit more friendly, if
> 
> … Modx.funcy(…)
> 
> would effectively try to load Modx automatically, if not already loaded.

This doesn’t work in Matlab either. Either `Modx` is in the path, or it isn’t.

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [March 2, 2018, 1:58pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/28 "2018-03-02T13:58:25Z")

</div>

Maybe at install time pop up a dialogue asking which packages you want “installed” and create startup.jl will avoid some complaints?

---

<div class="post-metadata">

**Author:** ![Jordan\_Cluts](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jordan_cluts/32/13753_2.png) [@Jordan\_Cluts](https://discourse.julialang.org/u/Jordan_Cluts)\
**Post date:** [March 2, 2018, 2:17pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/29 "2018-03-02T14:17:03Z")

</div>

What if there were a simple function that added a package to juliarc automatically?

It seems it’d be relatively easy to create a function such as Pkg.onstartup(“LinearAlgebra”) that would append the appropriate “using LinearAlgebra” to the juliarc file. This could make it easier for newer users to always have the packages they want without having to dig into the startup file. More advanced users could of course always customize rc as needed.

Another alternative would be a function such as edit\_startup() that would simply open the startup/juliarc file for editing, preventing a new user from having to go and find it. It can be tricky to find sometimes.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [March 2, 2018, 2:45pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/30 "2018-03-02T14:45:50Z")

</div>

Hmm, ok, I guess that what you mean is, whenever a folder is in the path, you can just dump m-files in it, and they will be available. They are sort of automatically `include`d.

---

<div class="post-metadata">

**Author:** ![stephancb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephancb/32/14243_2.png) [@stephancb](https://discourse.julialang.org/u/stephancb)\
**Post date:** [March 2, 2018, 2:46pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/31 "2018-03-02T14:46:10Z")

</div>

In MATLAB, if I write `newfunc.m` and put this file in a folder that is already in the path, then it will be found, no need to fiddle with `startup.m` or `pathdef.m`. `newfunc(...)` will be available automatically throughout my MATLAB code.

In Julia there are two options:

1. I edit an an already existing and used file `Modx.jl` and add `newfunc(...)` there. Yes, then `Modx.newfunc(...)` becomes available automatically (via `Require.jl`). The disadvantage is, that the `Modx.jl` becomes with time large and difficult to edit with relatively unrelated code for different functions.

2. I start with a new file for the new function (having this habit from MATLAB) and create `Newm.jl`:

> module Newm  
> function newfunc(…)  
> …  
> end

Now, to have `Newm.newfunc(...)` available in the rest of my Julia code, I need to add

> using Newm

either in `.juliarc.jl` which would then with time load a lot of modules, or add this in all the different files where it is needed.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [March 2, 2018, 2:46pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/32 "2018-03-02T14:46:44Z")

</div>

> [@Jordan\_Cluts](#):
>
> What if there were a simple function that added a package to juliarc automatically?

```julia
shell> subl ~/.julia/config/startup.jl

```

:troll:

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [March 2, 2018, 2:56pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/33 "2018-03-02T14:56:28Z")

</div>

```julia
shell> subl ~/.julia/config/startup.jl
/bin/bash: subl: command not found

```

:troll: :troll:

More seriously, providing a command which works everywhere (including across platforms) is very helpful for tutorials and documentation.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 2, 2018, 3:01pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/34 "2018-03-02T15:01:14Z")

</div>

> [@stephancb](#):
>
> In MATLAB, if I write newfunc.m and put this file in a folder that is already in the path, then it will be found, no need to fiddle with startup.m or pathdef.m. newfunc(…) will be available automatically throughout my MATLAB code.

This is what makes installing “packages” in MATLAB terrifying.

---

<div class="post-metadata">

**Author:** ![jtravs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jtravs/32/2010_2.png) [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Post date:** [March 2, 2018, 3:42pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/35 "2018-03-02T15:42:33Z")

</div>

FWIW I much prefer requiring `using Package` as it makes intention explicit, and it is hardly a big burden. Of all the possible issues with Julia (which are quickly diminishing), I really struggle to understand how this one is so important?!

---

<div class="post-metadata">

**Author:** ![NaOH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naoh/32/5632_2.png) [@NaOH](https://discourse.julialang.org/u/NaOH)\
**Post date:** [March 2, 2018, 3:42pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/36 "2018-03-02T15:42:47Z")

</div>

> [@antoine-levitt](#):
>
> Maybe a good workaround is a using SimpleNumerics which, without going full Matlab compatibility, would include relevant packages and possibly provide shortcuts (eg keep zeros/ones/eye if it’s deprecated))

This could be solved easily with yet another package IMHO, ie. `KitchenSink.jl`, here you import and **[`Reexport.jl`](https://github.com/simonster/Reexport.jl)** the packages you need, then in you other packages and in your `.juliarc.jl`/`startup.jl` you just install `KitchenSink` and do `using KitchenSink` (here you could take care of versions compatibility, making sure there are no name collisions and define some aliases, etc.)

I have one setup for my `.juliarc.jl` that is a package I’ve used as an example for teaching, how to take care of your `.juliarc.jl` file, also creating and managing a package at the same: [`JuliaRC.jl`](https://github.com/SalchiPapa/JuliaRC.jl/tree/master/src), though I haven’t used `Reexport` yet in that one.

These are my very important aliases: 😛

```julia
[@eval $🔣() = run($🔡) for (🔣, 🔡) ∈ (:🐍 => `python`, :🐙 => `hy`, :λ => `clojure`, :💎 => `irb`, :💻 => `cling`, :🎮 => `nethack`)]

```

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [March 2, 2018, 5:25pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/37 "2018-03-02T17:25:19Z")

</div>

> [@jtravs](#):
>
> FWIW I much prefer requiring using Package as it makes intention explicit, and it is hardly a big burden. Of all the possible issues with Julia (which are quickly diminishing), I really struggle to understand how this one is so important?!

People are probably referring to working on the REPL, where it is indeed annoying having to type `using MyPackage`.

I don’t think anyone is complaining about doing this in modules (where `startup.jl` won’t help).

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [March 2, 2018, 5:48pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/38 "2018-03-02T17:48:16Z")

</div>

This suggestion has got to be one of the best suggestions of 2018!

`Pkg.onstartup("LinearAlgebra")` FTW!

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [March 2, 2018, 6:17pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/39 "2018-03-02T18:17:05Z")

</div>

I dare say that `LinearAlgebra` is probably the one thing that absolutely everybody will agree should be included on startup, always. It just seems somehow “sacred”.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 2, 2018, 7:08pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/40 "2018-03-02T19:08:03Z")

</div>

> [@ExpandingMan](#):
>
> I dare say that LinearAlgebra is probably the one thing that absolutely everybody will agree should be included on startup, always. It just seems somehow “sacred”.

Isn’t it just some special matrix types? Most linear algebra is in Base still?

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [March 2, 2018, 7:12pm UTC](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433/41 "2018-03-02T19:12:44Z")

</div>

> [@ExpandingMan](#):
>
> I dare say that LinearAlgebra is probably the one thing that absolutely everybody will agree should be included on startup, always.

Nope - it’s the very first thing that I want to get rid of.  
For general-purpose computing, or having small scripts, having all of that overhead is the last thing I want.

[Previous page](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433.md?page=1)

[Next page](https://discourse.julialang.org/t/1-0-annoyances-and-matlab-comparison/9433.md?page=3)
