-
Notifications
You must be signed in to change notification settings - Fork 107
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
Post Mortem for {.experimental: "ForLoopMacros".} #120
Comments
Come on, this is just a nim bug. More info: |
well, this certainly has lots of detail - kudos for that - good to have a trail always in case it comes up in discussion. what's crucial about this type of events is that they break flow for the whole team, as more people get involved in "upgrading nim" than is necessary. we've talked about how to move forwards with this in the channel and elsewhere, so let's write it down here as well:
|
Please consider that not only |
Post Mortem for {.experimental: "ForLoopMacros".}
Before I start, this first post will focus on facts. All opinions part will be cleanly separated.
Also the feature is called
ForLoopStmt
but its flag is calledForLoopMacros
.Context
Starting from Friday August, 17 continuous integration (CI) of Nimbus started to fail.
Subsequently while trying fixes in decreasing order of desiredness, several discussions
were sparked within the team regarding reliance on unstable features and simplification of the code.
History:
const
across all EVM constantsfunc
/noSideEffect
to detect reliance on global/shared state is easier as globalconst
{.experimental: "Flag".}
pragma - Uint - allow compile-time evaluation for all procs nim-stint#54{. experimental: "Foo" .}
where the feature is used{.experimental: "ForLoopMacros".}
where the macro was definednot at the macro definition site - Usability: {.experimental: “ForLoopMacros”.} is required at all macro callsites nim-lang/Nim#8676 (comment)
{.experimental: "ForLoopMacros".}
everywhere: status-im/nim-stint@f0efc37due to generics early symbol resolution: [Meta] Generics/Static early symbol resolution nim-lang/Nim#8677 (meta issue raised during the investigation)
nimbus/nim.cfg
config leaks intonimbus/Nim/
compilation options including csources and koch--skipProjCfg --skipParentCfg
create another error - --skipProjCfg --skipParentCfg do not work when compiling koch from csources nim-lang/Nim#8691 (comment)nimble test
task in Don't use stint's nim.cfg during CI to compile koch nim-stint#63switch("experimental", "ForLoopMacros")
nimble install -y
instead ofnimble install -dy
in the Appveyor configDifferences between each "solutions"
In code
Due to nim-lang/Nim#8677,
{.experimental: "ForLoopStmt"}
is needed everywhere a Stint comparison is used.This is an artifact of how
experimental
, macro call and generics early symbol resolution interact. Without any one of those elements,{.experimental: "ForLoopStmt"}
can be contained in Stint and wouldn't contaminate packages that depends on it like NimbusIn nim.cfg
This means that locally devs can use
nim c foo.nim
and have the flag automatically turn on.All nimble tasks would also picked this
nim.cfg
automatically.Unfortunately, all libraries that depend on Stint would need to ship a nim.cfg
Since for CI, Nim compiler is bootstrapped as a subfolder of the project, it gets compiled with the project nim.cfg.
The current
csources
do not support the--experimental
switch and CI fails (except Travis + Docker).Araq mentionned the following solution on 2018-08-21 that mratsim did not see before writing the postmortem - nim-lang/Nim#8691 (comment)
In nimbus.nimble
There is no contamination to Nim compilation.
All nimble tasks must add the switch.
Locally all devs must have their own
nim.cfg
, use nimble tasks (or vscode tasks) ornim --experimental:ForLoopStmt c foo.nim
CI must use the hidden undocumented
-d
flag when installing dependencies.After installing, nimble tries to compile the code to produce a binary (even for libraries),
since this is done without the --experimental flag either in the code or via a
nim.cfg
, dependency installation fails.The text was updated successfully, but these errors were encountered: