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

pegs.nim now compiles with strictFuncs #18111

Closed
wants to merge 3 commits into from
Closed

pegs.nim now compiles with strictFuncs #18111

wants to merge 3 commits into from

Conversation

nc-x
Copy link
Contributor

@nc-x nc-x commented May 27, 2021

Closes #18057
Closes #16892

The issue here is that with strictFuncs, if we are calling a function inside a noSideEffect function, then that called function must also be marked as noSideEffect. (I have never used noSideEffect/strictFuncs before so idk whether this is expected behaviour or not.)
This PR converts few procs to funcs so that pegs.nim compiles properly.


This PR also updates all noSideEffect procs in pegs.nim to use func instead.
The changes for this are in a separate commit for easy review.

lib/pure/pegs.nim Outdated Show resolved Hide resolved
lib/pure/pegs.nim Outdated Show resolved Hide resolved
lib/pure/pegs.nim Outdated Show resolved Hide resolved
@konsumlamm
Copy link
Contributor

The issue here is that with strictFuncs, if we are calling a function inside a noSideEffect function, then that called function must also be marked as noSideEffect. I am not sure whether this is expected behaviour or not.

That is intended, that's exactly the point of func/noSideEffect (even without strictFuncs).

@nc-x
Copy link
Contributor Author

nc-x commented May 27, 2021

func/noSideEffects/strictFuncs need better error messages, so that they list out where the side effects come from. Going through a huge file looking for side effects is pretty annoying, and take out any advantage that they could provide.

@nc-x nc-x closed this May 27, 2021
@nc-x nc-x deleted the pegs branch May 27, 2021 15:32
@timotheecour
Copy link
Member

timotheecour commented May 27, 2021

func/noSideEffects/strictFuncs need better error messages, so that they list out where the side effects come from

PR welcome

some of the changes in this PR were useful ({. noSideEffect.} => func)

other than that, I consider the current design for strictFuncs+views broken (#16305) so that's what should be fixed instead, not stdlib (there are better alternatives as discussed elsewhere)

@quantimnot
Copy link
Contributor

@nc-x Why was this closed?
I would like to be able to use strictFunc globally for some of my projects that use the pegs module.

quantimnot added a commit to quantimnot/Nim that referenced this pull request Oct 4, 2021
Enabled `std/pegs` in the `strictFuncs` import test.

Fixes nim-lang#18057
Fixes nim-lang#16892
See nim-lang#18111
quantimnot added a commit to quantimnot/Nim that referenced this pull request Oct 4, 2021
Enabled `std/pegs` in the `strictFuncs` import test.

Fixes nim-lang#18057
Fixes nim-lang#16892
See nim-lang#18111
Araq pushed a commit that referenced this pull request Oct 7, 2021
* Fixed `strictFuncs` support for `std/pegs`

Enabled `std/pegs` in the `strictFuncs` import test.

Fixes #18057
Fixes #16892
See #18111

* Rebased from `devel`

* Conditionally compile `std/pegs` in `koch`

This is for supporting `csources` bootstrap.

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
PMunch pushed a commit to PMunch/Nim that referenced this pull request Mar 28, 2022
* Fixed `strictFuncs` support for `std/pegs`

Enabled `std/pegs` in the `strictFuncs` import test.

Fixes nim-lang#18057
Fixes nim-lang#16892
See nim-lang#18111

* Rebased from `devel`

* Conditionally compile `std/pegs` in `koch`

This is for supporting `csources` bootstrap.

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
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.

pegs.nim(344, 6) Error: 'nonterminal' can have side effects strictFuncs + views: cannot import pegs
4 participants