docopt.nim icon indicating copy to clipboard operation
docopt.nim copied to clipboard

Does not compile with ARC or ORC GCs

Open Benjamin-Lee opened this issue 3 years ago • 2 comments

My program:

let doc = """
Naval Fate.

Usage:
  naval_fate ship new <name>...
  naval_fate ship <name> move <x> <y> [--speed=<kn>]
  naval_fate ship shoot <x> <y>
  naval_fate mine (set|remove) <x> <y> [--moored | --drifting]
  naval_fate (-h | --help)
  naval_fate --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  --speed=<kn>  Speed in knots [default: 10].
  --moored      Moored (anchored) mine.
  --drifting    Drifting mine.
"""

import docopt

let args = docopt(doc, version = "Naval Fate 2.0")
echo args

It works with 0.6.7:

~/D/P/R/viroid-search ❯❯❯ nimble c --gc:arc -d:danger src/play                                                                 (viroid-search)
  Verifying dependencies for [email protected]
      Info: Dependency on [email protected] already satisfied
  Verifying dependencies for [email protected]
  Compiling src/play (from package viroid_search) using c backend
Hint: used config file '/usr/local/Cellar/nim/1.2.0/nim/config/nim.cfg' [Conf]
Hint: used config file '/Users/BenjaminLee/Desktop/Python/Research/viroid-search/nim.cfg' [Conf]
Hint: system [Processing]
Hint: repr_v2 [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: play [Processing]
Hint: docopt [Processing]
Hint: nre [Processing]
Hint: pcre [Processing]
Hint: util [Processing]
Hint: tables [Processing]
Hint: hashes [Processing]
Hint: math [Processing]
Hint: bitops [Processing]
Hint: macros [Processing]
Hint: algorithm [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: unicode [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: os [Processing]
Hint: pathnorm [Processing]
Hint: osseps [Processing]
Hint: posix [Processing]
Hint: times [Processing]
Hint: sequtils [Processing]
Hint: util [Processing]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(578, 41) Hint: passing 'doc' to a sink parameter introduces an implicit copy; use 'move(doc)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(580, 34) Hint: passing 'doc' to a sink parameter introduces an implicit copy; use 'move(doc)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(587, 42) Hint: passing 'doc' to a sink parameter introduces an implicit copy; use 'move(doc)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(597, 31) Hint: passing 'a.value' to a sink parameter introduces an implicit copy; use 'move(a.value)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(599, 31) Hint: passing 'a.value' to a sink parameter introduces an implicit copy; use 'move(a.value)' to prevent it [Performance]
/usr/local/Cellar/nim/1.2.0/nim/lib/impure/nre.nim(565, 13) Hint: passing 'str' to a sink parameter introduces an implicit copy; use 'move(str)' to prevent it [Performance]
/usr/local/Cellar/nim/1.2.0/nim/lib/impure/nre.nim(492, 54) Hint: passing 'str' to a sink parameter introduces an implicit copy; use 'move(str)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(65, 48) Hint: passing 'value' to a sink parameter introduces an implicit copy; use 'move(value)' to prevent it [Performance]
/usr/local/Cellar/nim/1.2.0/nim/lib/impure/nre.nim(565, 13) Hint: passing 'str' to a sink parameter introduces an implicit copy; use 'move(str)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(368, 42) Hint: passing 'it.long' to a sink parameter introduces an implicit copy; use 'move(it.long)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(378, 30) Hint: passing 'similar[0].short' to a sink parameter introduces an implicit copy; use 'move(similar[0].short)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(378, 48) Hint: passing 'similar[0].long' to a sink parameter introduces an implicit copy; use 'move(similar[0].long)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(379, 51) Hint: passing 'similar[0].value' to a sink parameter introduces an implicit copy; use 'move(similar[0].value)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(416, 41) Hint: passing 'similar[0].long' to a sink parameter introduces an implicit copy; use 'move(similar[0].long)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.7/docopt.nim(417, 55) Hint: passing 'similar[0].value' to a sink parameter introduces an implicit copy; use 'move(similar[0].value)' to prevent it [Performance]
Hint:  [Link]
Hint: 47868 LOC; 0.958 sec; 72.492MiB peakmem; Dangerous Release build; proj: /Users/BenjaminLee/Desktop/Python/Research/viroid-search/src/play; out: /Users/BenjaminLee/Desktop/Python/Research/viroid-search/src/play [SuccessX]
   Success: Execution finished
~/D/P/R/viroid-search ❯❯❯

But not 0.6.8:

~/D/P/R/viroid-search ❯❯❯ nimble c --gc:arc -d:danger src/play                                                                 (viroid-search)
  Verifying dependencies for [email protected]
      Info: Dependency on [email protected] already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on regex@>= 0.7.4 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on unicodedb@>= 0.7.2 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on unicodeplus@>= 0.5.0 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on unicodedb@>= 0.8 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on segmentation@>= 0.1 already satisfied
  Verifying dependencies for [email protected]
      Info: Dependency on unicodedb@>= 0.8.0 already satisfied
  Verifying dependencies for [email protected]
  Compiling src/play (from package viroid_search) using c backend
Hint: used config file '/usr/local/Cellar/nim/1.2.0/nim/config/nim.cfg' [Conf]
Hint: used config file '/Users/BenjaminLee/Desktop/Python/Research/viroid-search/nim.cfg' [Conf]
Hint: system [Processing]
Hint: repr_v2 [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: play [Processing]
Hint: docopt [Processing]
Hint: regex [Processing]
Hint: tables [Processing]
Hint: hashes [Processing]
Hint: math [Processing]
Hint: bitops [Processing]
Hint: macros [Processing]
Hint: algorithm [Processing]
Hint: sequtils [Processing]
Hint: unicode [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: nodetype [Processing]
Hint: sets [Processing]
Hint: properties [Processing]
Hint: properties_data [Processing]
Hint: common [Processing]
Hint: parser [Processing]
Hint: scanner [Processing]
Hint: exptransformation [Processing]
Hint: nfatype [Processing]
Hint: nfa [Processing]
Hint: deques [Processing]
Hint: nfamatch [Processing]
Hint: nodematch [Processing]
Hint: types [Processing]
Hint: types_data [Processing]
Hint: unicodeplus [Processing]
Hint: casing [Processing]
Hint: casing_data [Processing]
Hint: segmentation [Processing]
Hint: segmentation [Processing]
Hint: segmentation_data [Processing]
Hint: nfamacro [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: os [Processing]
Hint: pathnorm [Processing]
Hint: osseps [Processing]
Hint: posix [Processing]
Hint: times [Processing]
Hint: util [Processing]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.8/docopt.nim(598, 31) Hint: passing 'a.value' to a sink parameter introduces an implicit copy; use 'move(a.value)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.8/docopt.nim(600, 31) Hint: passing 'a.value' to a sink parameter introduces an implicit copy; use 'move(a.value)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/nfa.nim(245, 20) Hint: passing 'eNfa[z]' to a sink parameter introduces an implicit copy; use 'move(eNfa[z])' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/nfa.nim(247, 27) Hint: passing 'zc' to a sink parameter introduces an implicit copy; use 'move(zc)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/nfa.nim(102, 18) Hint: passing 'n' to a sink parameter introduces an implicit copy; use 'move(n)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/nfa.nim(115, 18) Hint: passing 'n' to a sink parameter introduces an implicit copy; use 'move(n)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/nfa.nim(127, 18) Hint: passing 'n' to a sink parameter introduces an implicit copy; use 'move(n)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/exptransformation.nim(408, 19) Hint: passing 'ops[len(ops) - i]' to a sink parameter introduces an implicit copy; use 'move(ops[len(ops) - i])' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/exptransformation.nim(206, 20) Hint: passing 'n' to a sink parameter introduces an implicit copy; use 'move(n)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/exptransformation.nim(213, 22) Hint: passing 'n.flags' to a sink parameter introduces an implicit copy; use 'move(n.flags)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/exptransformation.nim(215, 18) Hint: passing 'n.flags' to a sink parameter introduces an implicit copy; use 'move(n.flags)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/exptransformation.nim(223, 16) Hint: passing 'n' to a sink parameter introduces an implicit copy; use 'move(n)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/exptransformation.nim(36, 16) Hint: passing 'n' to a sink parameter introduces an implicit copy; use 'move(n)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/exptransformation.nim(61, 23) Hint: passing 'n.name' to a sink parameter introduces an implicit copy; use 'move(n.name)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/scanner.nim(22, 10) Hint: passing 'raw' to a sink parameter introduces an implicit copy; use 'move(raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(207, 41) Hint: passing 'name' to a sink parameter introduces an implicit copy; use 'move(name)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(401, 13) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(412, 11) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0/regex/parser.nim(51, 32) Hint: passing 'sc.raw' to a sink parameter introduces an implicit copy; use 'move(sc.raw)' to prevent it [Performance]
fatal.nim(49)            sysFatal
Error: unhandled exception: ccgexprs.nim(777, 11) `ty.kind in {tyTuple, tyObject}`  [AssertionError]
       Tip: 15 messages have been suppressed, use --verbose to show them.
     Error: Execution failed with exit code 256
        ... Command: "/usr/local/Cellar/nim/1.2.0/nim/bin/nim" c --noNimblePath -d:NimblePkgVersion=0.1.0 --path:"/Users/BenjaminLee/.nimble/pkgs/docopt-0.6.8" --path:"/Users/BenjaminLee/.nimble/pkgs/regex-0.15.0" --path:"/Users/BenjaminLee/.nimble/pkgs/unicodedb-0.9.0" --path:"/Users/BenjaminLee/.nimble/pkgs/unicodeplus-0.6.0" --path:"/Users/BenjaminLee/.nimble/pkgs/unicodedb-0.9.0" --path:"/Users/BenjaminLee/.nimble/pkgs/segmentation-0.1.0" --path:"/Users/BenjaminLee/.nimble/pkgs/unicodedb-0.9.0" "--gc:arc" "-d:danger"  "src/play"

Benjamin-Lee avatar Oct 15 '20 19:10 Benjamin-Lee

Correction: it compiles but fails to work when using --gc:arc with 0.6.7:

~/D/P/R/viroid-search ❯❯❯ nimble --gc:arc -d:danger run viroid_search -k 17 -f GSM458930-2718.fasta --output test.fa           (viroid-search)
  Verifying dependencies for [email protected]
      Info: Dependency on [email protected] already satisfied
  Verifying dependencies for [email protected]
   Building viroid_search/viroid_search using c backend
Usage:
    viroid_search (--kmer=<int>) [--fasta=<file>] [--output=<file>] [--cache]

The expected behavior is some processing going on. This happens when compiled with --gc:refc:

~/D/P/R/viroid-search ❯❯❯ nimble --gc:refc -d:danger run viroid_search -k 17 -f GSM458930-2718.fasta --output test.fa          (viroid-search)
  Verifying dependencies for [email protected]
      Info: Dependency on [email protected] already satisfied
  Verifying dependencies for [email protected]
   Building viroid_search/viroid_search using c backend
{"--fasta": GSM458930-2718.fasta, "--cache": false, "--output": test.fa, "--kmer": 17}
[Info] Loading reads from GSM458930-2718.fasta...
[Info] Loaded 489094 unique reads from 489094 total reads. Beginning filtering...
^CSIGINT: Interrupted by Ctrl-C.
       Tip: 2 messages have been suppressed, use --verbose to show them.
     Error: Execution failed with exit code 256
        ... Command: /Users/BenjaminLee/Desktop/Python/Research/viroid-search/viroid_search -k 17 -f GSM458930-2718.fasta --output test.fa
~/D/P/R/viroid-search ❯❯❯

Benjamin-Lee avatar Oct 15 '20 20:10 Benjamin-Lee

The recent versions of docopt.nim compile with ARC/ORC. You might be trapped with 0.6.7, as 0.7.0 and 0.7.1 haven't been released yet (as of march-2024), so the nimble tool doesn't find them. To install a recent version put this on your .nimble files:

requires "docopt#v0.7.1"

I.e. find the package by tag, not by release.

xbello avatar Mar 26 '24 12:03 xbello