checked arrays enabled in advanced

Description

Checked arrays is supposed to be disabled if you do an advanced build, but it is not.

If you look at the output you will see lines like

Environment

None

Activity

Show:
Mike Fikes
April 24, 2021, 2:24 PM
Edited

While CLJS-3303.patch addresses the fundamental issue of looking at the right place to determine if code is being compiled under :advanced, CLJS-3303-2.patch, which adds :optimizations to the build-affecting options, would really be needed because specifying :advanced affects the code generated.

You can see this if, for example, you explicitly specify some of the implicit options that come with :advanced:

and then switch between building with -0 advanced or not: The result would be that the code would not be regenerated.

If we go with adding :optimizations to build-affecting options, this would work with the global AOT-caching feature, ensuring code generated for JARs is stored under a hash reflecting :optimizations.

The only way I can thing to avoid adding :optimizations as a build-affecting option is to rethink how the checked arrays feature works and to try to involve Closure to eliminate it under advanced somehow.

Perhaps another solution is to add some front end implicit suppression of :checked-arrays, disabling it if {{:advanced} is in effect.

And, of course, another option altogether is to simply allow checked arrays to flow through into :advanced builds, and expect that users would disable it explicitly for :advanced (but that would be at odds with the possibility of having checked arrays be on by default.)

Mike Fikes
April 24, 2021, 12:39 PM
Edited

The relevant bit of code is cljs.analyzer/checked-arrays, which going back to ClojureScript 1.9.854 (when the checked arrays feature was first released) looked like this:

This is looking for :advanced to be directly in the :options map.

This is not a regression because it also occurs with 1.9.854.

Fixed

Assignee

David Nolen

Reporter

Mike Fikes