nim-lang / fusion

Fusion is for now an idea about how to grow Nim's ecosystem without the pain points of more traditional approaches.
MIT License
128 stars 16 forks source link

Fix #76, #82, #83, update docs, more constistent `opt <pattern> or <default>` implementation #77

Closed haxscramper closed 3 years ago

haxscramper commented 3 years ago

Enabling --gc:{orc,arc} caused macro to behave differently, by somehow mutating immutable access path passed to the match expression generator. I wasn't able to reliably reproduce the bug, but it wasn't related to implementation itself.

Fixed that by explicitly copying path each time it is passed around - usually it is a sequence of 3-4 access elements, and copying only happens during macro evaluation.

Related: https://github.com/nim-lang/fusion/issues/76

ghost commented 3 years ago

The relevant issue is https://github.com/nim-lang/Nim/issues/17199 by the way so this is a workaround I guess?

ghost commented 3 years ago

might not be needed if https://github.com/nim-lang/Nim/pull/17348 works and will be merged

haxscramper commented 3 years ago

Reverting this is a simple find-replace for fullCopy calls, but it would make it work for current version (because even if https://github.com/nim-lang/Nim/pull/17348 is merged, it would still take quite some time until next release). And it also contains more tests and small fixup for the API (some procs like findItFirstOpt that were meant for internal use were exported)

haxscramper commented 3 years ago

This PR is done - aside from adding missing support for opt pattern for fields it does not implement any new functionality, only fixes some documentation inconsistencies and fixes https://github.com/nim-lang/fusion/issues/82 and https://github.com/nim-lang/fusion/issues/76

haxscramper commented 3 years ago

Fix https://github.com/nim-lang/fusion/issues/83

haxscramper commented 3 years ago

CI failure unrelated to fusion/matching implementation - linux-i386 (version-1-2) test for fusion CI fails because "could not load: libpcre.so(.3|.1|)"

haxscramper commented 3 years ago

CI failure unrelated - all the failures happened on "install dependencies" stage.