Skip to main content

17 - No Duplicate Arguments

From edition=16 onwards, the compiler will now error if the same argument is provided twice when calling a function. This stops you wasting time trying to modify a parameter without realizing that it is being overridden by a later argument.

What's changed?

Sometimes in Easel, your function calls have some many arguments that it is hard to see you have accidentally provided the same argument twice:

Spark(color=#ff8800, glaze=0.5, radius=2, bloom=3, glaze=1)

Notice the glaze parameter is provided twice above. The problem with this is, as a developer, you may be trying to experiment with different values for the glaze parameter, only to you surprised to see it has no effect. It may take you some time to realize it is because the second glaze argument is overriding the first one, and you have been editing the first one all along. This is a waste of time for you as a developer.

Upgrade instructions

First, set edition=17 (or higher) in your easel.toml file:

[engine]
edition = 17

Now, when you Preview your game, you may get some errors due to duplicate arguments. Simply delete the duplicate argument to fix the error. The last argument will always be the one that was being used, so you can delete the earlier ones.

Opt-out

If you would like to temporarily opt out your entire project from this change, add allowDuplicateArgs=true to the [legacy] section of your easel.toml, like this:

[legacy]
allowDuplicateArgs = true