Compiler: Code generation creates identifiers starting with invalid characters

Created on 26 Aug 2018  路  5Comments  路  Source: elm/compiler

Certain generated variable names start with the username of the account that published the package they're in. If that username begins with an invalid character (i.e. a number), the code generates errors and does not run.
I discovered this while trying to use https://package.elm-lang.org/packages/1602/elm-feather/latest/

From what I can tell this is a problem introduced with the changes in 0.19, because I was using this same package in 0.18 without problems.

This error can be reproduced simply by compiling an Elm program using 1602/elm-feather, but I have a compilable example you can see here: https://github.com/MightyAlex200/Comet/tree/ui-elm-19
Just run make in ui/, then open index.html

Related to #1377 and #710

bug gen

Most helpful comment

Doing a new release of binaries is quite expensive. It takes maybe a three days to get everything set up, and then I need to have a testing phase for the community to see if it works on a bunch of different platforms. Then the folks who manage other install paths like npm, homebrew, and aur need to get things working.

All together, this is a pretty big cost across quite a lot of people, so I would like to get a decent number of fixes together before putting something out.

I don't know what the best path is in your scenario.

All 5 comments

Example of generated code:

var 1602$json_schema$Json$Schema$Builder$SchemaBuilder = function (a) {
    return {$: 'SchemaBuilder', a: a};
};

(when using 1602/json-schema package)

Is there a plan to patch this bug within 0.19.x?

People keep asking me what to do if they want to use some of my elm libraries, I'd appreciate some insight here.

As a workaround you could run a find and replace on the generated Javascript.

Doing a new release of binaries is quite expensive. It takes maybe a three days to get everything set up, and then I need to have a testing phase for the community to see if it works on a bunch of different platforms. Then the folks who manage other install paths like npm, homebrew, and aur need to get things working.

All together, this is a pretty big cost across quite a lot of people, so I would like to get a decent number of fixes together before putting something out.

I don't know what the best path is in your scenario.

Yup, it makes sense to batch bug-fixes and release them all at once, given costs associated with the compiler release.

Speaking of my projects, I think it would be okay to rename.

Was this page helpful?
0 / 5 - 0 ratings