zero-functional / zero-functional

A library providing zero-cost chaining for functional abstractions in Nim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: undeclared identifier: 'SEQUENCE_HANDLERS'

timotheecour opened this issue · comments

/Users/timothee/git_clone/nim/timn/tests/nim/t17_zerofunc2.nim(1, 1) template/generic instantiation from here
/Users/timothee/.nimble_choosenim/pkgs/zero_functional-0.1.0/zero_functional.nim(133, 3) Error: undeclared identifier: 'SEQUENCE_HANDLERS'


import zero_functional

proc test1():auto=
  # filter all lines containing the word error in the iterator
  myFileIterator --> filter("error" in it) --> createIter(errorLines)
  if debug:
    errorLines() --> echo(it) # () must be used when working with iterators

test1()

... great - so I am not able to check anything this week and the next.

@timotheecour
You can try using the -->> instead of --> then copy the output - this is the code generated by -->> to your function (in if debug).
See also Debugging using -->>

If the generated code does not fail, then this is indeed a bug in zero_functiona. The error message is probably a bit strange though. As I said I will have a look by the end of July.

See also test.nim for some working examples (that probably even make sense sometimes). Try to understand the concepts also in the documentation. Also look closely at foreach

@timotheecour Did you install with nimble install zero_functional@#head? Recently Nim's scoping rules of static blocks have changed. zero_functional has already been adjusted to that, but if you install without specifying #head you will get the last tagged version which still uses a static block for SEQUENCE_HANDLERS.

$ nimble install zero_functional@#head
   Warning: Package 'timn' has an incorrect structure. It should contain a single directory hierarchy for source files, named 'timn', but file 'config.nim' is in a directory named 'src/timn' instead. This will be an error in the future.
      Hint: If 'src/timn' contains source files for building 'timn', rename it to 'timn'. Otherwise, prevent its installation by adding `skipDirs = @["src/timn"]` to the .nimble file.
Downloading https://github.com/alehander42/zero-functional using git
  Verifying dependencies for zero_functional@#head
 Installing zero_functional@#head
   Success: zero_functional installed successfully.

$ rnim tests/nim/t17_zerofunc2.nim
nim c --nimcache:/tmp/nim//nimcache/ -o:/tmp/nim//app -r tests/nim/t17_zerofunc2.nim
/Users/timothee/git_clone/nim/timn/tests/nim/t17_zerofunc2.nim(3, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/timn/tests/nim/t17_zerofunc2.nim(5, 44) template/generic instantiation from here
/Users/timothee/.nimble_choosenim/pkgs/zero_functional-#head/zero_functional.nim(1937, 16) Error: undeclared identifier: 'myFileIterator'
        result = quote:
                 ^

nim --version
Nim Compiler Version 0.18.1 [MacOSX: amd64]
Compiled at 2018-07-24
Copyright (c) 2006-2018 by Andreas Rumpf

git hash: d5c9255cab9c111f8fa930e4cd42d6671877bd9d
active boot switches: -d:release

... so: all in all
@bluenote10 sure - so I gonna make a version containing that fix
@timotheecour there is a compile error Error: undeclared identifier: 'myFileIterator' - you could try to fix it first, right?

OK - I'll close this one now sigh

@timotheecour opening bugs maybe a nice thing - but sometimes you'll have to help a little to close them. E.g. answer questions or giving feedback - anything. OK?

@michael72 well I'm also busy with fixing a number of other issues so sometimes I don't reply right away :-)

but thanks for the helpful answers, I fixed the example from the README that caused the above issue here: #37