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

Post Mortem for {.experimental: "ForLoopMacros".} #120

Closed
mratsim opened this issue Aug 24, 2018 · 3 comments
Closed

Post Mortem for {.experimental: "ForLoopMacros".} #120

mratsim opened this issue Aug 24, 2018 · 3 comments
Labels

Comments

@mratsim
Copy link
Contributor

mratsim commented Aug 24, 2018

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 called ForLoopMacros.

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:

Differences 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 Nimbus

In 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)

@if nimHasForLoopMacros:
--experimental: forLoopMacros
@end

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) or nim --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.

@yglukhov
Copy link
Contributor

Come on, this is just a nim bug.

More info: {.experimental: forLoopMacros.} needs only to be written in the module where the macro is defined.

@arnetheduck
Copy link
Member

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:

  • we lock the Nim version in use and prefer officially release versions unless there are strong reasons to go with a patched one - this to make it easy to get up and running with nimbus development for anyone
  • we use the branch from https://github.com/status-im/Nim for our own CI to increase trust in the CI pointing out failures in our code, not unrelated changes to Nim
  • when it's time for upgrades, one person deals with testing nimbus for a new Nim version and making sure that all components still work as expected. this work needs to be timed cautiously so as not to break other in-progress branches. once fallout is taken care of and the new version works, we switch our Nim branch to that version.

@cheatfate
Copy link
Contributor

Please consider that not only nimbus is affected there many repositories which needs to be tested too.

@mratsim mratsim closed this as completed Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants