Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error for Julia: 1.3 #34

Merged
merged 1 commit into from
Jul 21, 2020

Conversation

LakshyaKhatri
Copy link
Member

This PR will fix the current build error for Julia: 1.3 and similar future build errors for lower versions too.

The error:

Warning: Deprecated syntax `"begin" inside indexing expression` at /home/travis/build/JuliaClimate/CDSAPI.jl/src/CDSAPI.jl:78.
└ @ ~/build/JuliaClimate/CDSAPI.jl/src/CDSAPI.jl:78
ERROR: LoadError: syntax: extra token "]" after end of expression

Why this error?

See: begin - end current and future scope

In other words, In our code when we wrote:

dictstr_cpy = dictstr_cpy[begin:lastcomma_pos - 1] * dictstr_cpy[lastcomma_pos + 1:end]

Julia complains, since it was expecting the syntax:

# This sub expressions must resolve to valid index or slice
array[begin <some_expression> end]

# These sub expressions must resolve to valid indices
array[begin <some_expression> end : begin <some_expression_2> end]

Solution

A quick fix is to prevent using begin and end inside arrays because of the different behaviours in different versions of Julia.

@juliohm
Copy link
Member

juliohm commented Jul 21, 2020

You are correct, the begin syntax was only introduced in Julia v1.4. Thanks for the fix 💯

@juliohm juliohm merged commit 4b3f593 into JuliaClimate:master Jul 21, 2020
@LakshyaKhatri LakshyaKhatri deleted the julia1.3-build-patch branch July 21, 2020 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants