# Julia syntax

**URL:** <https://discourse.julialang.org/t/julia-syntax/98826>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [May 14, 2023, 8:35am UTC](https://discourse.julialang.org/t/julia-syntax/98826 "2023-05-14T08:35:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![AGoh2019](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/agoh2019/32/49566_2.png) [@AGoh2019](https://discourse.julialang.org/u/AGoh2019)\
**Post date:** [May 14, 2023, 8:35am UTC](https://discourse.julialang.org/t/julia-syntax/98826/1 "2023-05-14T08:35:24Z")

</div>

I wonder if the Julia syntax changes between versions. I have been using the online tutorial “Think Julia” but the constructs used in the ebook does not match the Julia 1.9.0 version’s REPL that I am using. Would hope that syntax changes do not happen within minor upgrades, and should only occur on major changes such as version 1 going into version 2.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 14, 2023, 8:46am UTC](https://discourse.julialang.org/t/julia-syntax/98826/2 "2023-05-14T08:46:02Z")

</div>

All of the syntax from Julia 1.0.0 should still work in Julia 1.9.0. We follow [semantic versioning](https://semver.org/). We may have added some aliases since then so that `Array{Int,2}` is now displayed as `Matrix{Int}`, but either name is valid.

Could you be more specific about what issues you are having at the moment?

---

<div class="post-metadata">

**Author:** ![AGoh2019](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/agoh2019/32/49566_2.png) [@AGoh2019](https://discourse.julialang.org/u/AGoh2019)\
**Post date:** [May 14, 2023, 11:08am UTC](https://discourse.julialang.org/t/julia-syntax/98826/3 "2023-05-14T11:08:08Z")

</div>

I will run a few more examples to see if I have any issues. And I borrowed the book “Julia: Bit by Bit” from the library to do a bit more.

— Andrew Goh

---

<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:** [May 14, 2023, 11:20am UTC](https://discourse.julialang.org/t/julia-syntax/98826/4 "2023-05-14T11:20:28Z")

</div>

To be clear: Julia syntax does _not_ change between minor versions. New syntax can be added, but old syntax cannot be removed. Any change that makes older code stop working _requires_ a major version change.

If you find code with outdated syntax, it must be from version 0.x.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [May 14, 2023, 11:44am UTC](https://discourse.julialang.org/t/julia-syntax/98826/5 "2023-05-14T11:44:37Z")

</div>

There can be package breaking changes, of course. Maybe that’s what happened to the OP.

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [May 14, 2023, 11:48am UTC](https://discourse.julialang.org/t/julia-syntax/98826/6 "2023-05-14T11:48:52Z")

</div>

> [@DNF](#):
>
> Julia syntax does _not_ change between minor versions.

Or more specifically, _public_ parts of the syntax, functions, etc. do not change. If the examples use some internals they may break for different minor versions. But tutorials shouldn’t do that.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 14, 2023, 4:46pm UTC](https://discourse.julialang.org/t/julia-syntax/98826/7 "2023-05-14T16:46:43Z")

</div>

By the way, we do have a set of online learning materials:

> **[Homepage](https://juliaacademy.com/)**
>
> The definitive source for learning all things Julia, for free!

I also recommend the help desk channels on Julia Slack and Zulip.

---

<div class="post-metadata">

**Author:** ![LeePhillips](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leephillips/32/205514_2.png) [@LeePhillips](https://discourse.julialang.org/u/LeePhillips)\
**Post date:** [May 14, 2023, 8:03pm UTC](https://discourse.julialang.org/t/julia-syntax/98826/8 "2023-05-14T20:03:03Z")

</div>

I can think of one minor (and probably pedantic) exception: the use of multiple semicolons starting with v.1.7, for array concatenation, means that earlier code that contained multiple semicolons (probably as a typo), which did not raise an error but were treated as a single semicolon, will behave differently in recent versions. There was one more like this, but I can’t remember it at the moment.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [May 15, 2023, 12:42pm UTC](https://discourse.julialang.org/t/julia-syntax/98826/9 "2023-05-15T12:42:54Z")

</div>

Yes, that is sort of pedantic. It’s the only example of changed meaning of syntax I recall (and the former meaning wasn’t useful). There have been some more “technically breaking” decisions, but I don’t recall if they were about syntax (what the syntax guarantee is about). The old meaning is kept in 1.6 LTS, so at least kept there (while no one should be relying on it, since its just buggy code), and I’ve not heard of any real-world problem rising out of this, i.e. no code working in 1.6 but not later (the opposite in not true, since there’s not backward compatibility, only forward claimed).

There’s also public API guarantee. And part of the public API has in some cases been experimental, e.g. for Threads. By not “most” (or all by now, I would like to know) of the thread API declared stable.

> [@heliosdrm](#):
>
> _public_ parts of the syntax

There’s no public part of syntax, or rather all of it is public. You have the (public) API in mind, strictly about _semantics_ not syntax (see also SemVer).

---

<div class="post-metadata">

**Author:** ![AGoh2019](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/agoh2019/32/49566_2.png) [@AGoh2019](https://discourse.julialang.org/u/AGoh2019)\
**Post date:** [May 16, 2023, 3:08am UTC](https://discourse.julialang.org/t/julia-syntax/98826/10 "2023-05-16T03:08:46Z")

</div>

Ran into this error:

@v1.9 pkg\> add ThinkJulia  
Updating registry at ‘C:\Users\HP…\General.toml’

ERROR: The following package names could not be resolved:

- ThinkJulia not found in project, manifest or registry).

Need to add in ThinkJulia before examples will run.

— Andrew Goh

Yes, that is sort of pedantic. It’s the only example of changed meaning of syntax I recall (and the former meaning wasn’t useful). There have been some more “technically breaking” decisions, but I don’t recall if they were about syntax (what the syntax guarantee is about). The old meaning is kept in 1.6 LTS, so at least kept there (while no one should be relying on it, since its just buggy code), and I’ve not heard of any real-world problem rising out of this, i.e. no code working in 1.6 but not later (the opposite in not true, since there’s not backward compatibility, only forward claimed).

There’s also public API guarantee. And pat of the public API has in some cases been experimental, e.g. for Threads. By not “most” (or all by now, I would like to know) of the thread API declared stable.

> ![](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/40/3851_2.png)heliosdrm:
> 
> _public_ parts of the syntax

There’s no public part of syntax, or rather all of it is public. You have the (public) API in mind, strictly about _semantics_ not syntax (see also SemVer).

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [May 16, 2023, 8:02am UTC](https://discourse.julialang.org/t/julia-syntax/98826/11 "2023-05-16T08:02:54Z")

</div>

The online version of ThinkJulia says this:

 ![Think Julia How to Think Like a Computer Scientist](https://global.discourse-cdn.com/julialang/original/3X/a/7/a77d4a98e03628ccc278fbcc6f96fb578e13cc85.png)

If you’ve found a reference that says `add ThinkJulia`, please share, so it can be corrected. (This package isn’t registered in the Julia general registry.)

I haven’t read the book, but it probably assumes that you’re starting at the beginning, and remembering what you learn during the process of working through it. A tutorial that continually repeats the ‘setting-up’ code gets tedious to read… 😀

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [May 21, 2023, 8:55pm UTC](https://discourse.julialang.org/t/julia-syntax/98826/12 "2023-05-21T20:55:18Z")

</div>

I thought you were asking if Threads were experimental, so I looked it up. I see you were however quoting me (in a non-obvious way), likely didn’t mean to quote me at all. So just delete that part of your post.

Anyway here are the docs, and most is no longer experimental, at least this:  
[https://docs.julialang.org/en/v1/base/multi-threading/](https://docs.julialang.org/en/v1/base/multi-threading/)

> Threads.@threads [schedule] for … end

but it got me thinking, why use that prefix `Threads.` It’s probably an holdover from since Threads were actually experimental. Base is exported, but Base.Threads isn’t, so you are reasing in with that prefix. That’s the hint that you are doing something with an experimental API. I believe that using this as now documented will always work.

But there’s another way. You can use:

```julia
using Base.Threads
[..]
@threads [schedule] for ... end 

```

For the loop that seems better. But `using Base.Threads` still seems like reaching in, and should `using Threads` or even it implicit?

At least some part’s af Julia are still experimental, and all of it should be documented, e.g. “ccall using a libuv threadpool (Experimental)” is.

First introduced here:

> **[Announcing composable multi-threaded parallelism in Julia](https://julialang.org/blog/2019/07/multithreading/)**
>
> Announcing composable multi-threaded parallelism in Julia | Software performance depends more and more on exploiting multiple processor cores....

> In version 0.5 about two years later, we released the `@threads for` macro with “experimental” status
