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

fix for https://github.com/nim-lang/Nim/pull/15545 #177

Merged
merged 1 commit into from
Oct 21, 2020

Conversation

timotheecour
Copy link
Contributor

@timotheecour timotheecour commented Oct 20, 2020

fix for nim-lang/Nim#15545 ; it's the only important_package that was broken under nim-lang/Nim#15545

trailing else was implemented here: nim-lang/Nim#14190

@Araq
Copy link

Araq commented Oct 26, 2020

This shouldn't have been merged, the PR it refers to wasn't accepted and there is a better way to do this. Besides this breaks "nimpy" for the 1.2.x line.

Copy link
Contributor

@narimiran narimiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yglukhov Just to let you know that after the changes in this PR, nimpy is now broken on our CIs for Nim 1.2.x and 1.0.x branches.

(EDIT: ah, Araq was faster than me :))

@yglukhov
Copy link
Owner

I've got no strong opinion about how it should be done. Just tell me if I should revert it :)

@timotheecour
Copy link
Contributor Author

timotheecour commented Oct 26, 2020

if this PR is reverted can we backport trailing else feature to 1.0.X and 1.2.X branches for similar reasons as nim-lang/RFCs#214

there is a better way to do this

which one besides making the code more complicated / potentially less efficient / less type-checked with something like:

case expr
of f1: ...
of f2: ...
of f3: ...

=>
template handleF3() = ...
let x = expr
case x
of f1: ...
of f2: ...
else:
  when isOldEnum:
    if x == f3:
      handleF3()
    else: doAssert false # checking whether it's exhaustive is now only RT, not CT
  else:
    case x
    of f3: handleF3()
    of f4: ...
    of f5: ...      
    else: doAssert false # ditto

(done this way to keep code DRY)

(see also nim-lang/Nim#15646 (comment))

@narimiran
Copy link
Contributor

Just tell me if I should revert it :)

yes :)

yglukhov added a commit that referenced this pull request Oct 26, 2020
yglukhov added a commit that referenced this pull request Oct 26, 2020
@yglukhov
Copy link
Owner

Reverted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants