SciNim / nim-plotly

plotly wrapper for nim-lang
https://scinim.github.io/nim-plotly/
MIT License
179 stars 15 forks source link

attempting to call undeclared routine: 'mapIt' #63

Open bluenote10 opened 4 years ago

bluenote10 commented 4 years ago

I tried to get NimData to work on latest devel again, but I'm running into a weird problem coming from its plotly dependence. On travis I'm getting the error:

/home/travis/build/bluenote10/NimData/examples/example_01.nim(161, 5) template/generic instantiation of `heatmap` from here
/home/travis/build/bluenote10/NimData/src/nimdata/plotting.nim(32, 10) template/generic instantiation of `heatmap` from here
/home/travis/.nimble/pkgs/plotly-0.2.0/plotly/plotly_sugar.nim(64, 16) Error: attempting to call undeclared routine: 'mapIt'

I'm not quite sure why that is happening, because the code makes sense on first glance. Or do all these templates require to actually bind the symbols?

Vindaar commented 4 years ago

Hm, it's possible that this is a recent regression / change on devel. I'll take a look at it.

edit: the problem might just be that heatmap is just a template and so mapIt isn't found, because it's not imported in example_01.nim. Can you check if it works if you import sequtils there?

Also not sure if comments on commits show up in your notifications, so a link here: https://github.com/bluenote10/NimData/commit/8320f3c56ff9effd5f5ead1b4bfd1d2e88266042#commitcomment-40727862

bluenote10 commented 3 years ago

edit: the problem might just be that heatmap is just a template and so mapIt isn't found, because it's not imported in example_01.nim

Yes manually importing on client side should be possible, but I've raised this as an issue, because that's not how such a problem should be worked around. It's normally the responsibility of the template author to bind necessary symbols properly. Otherwise client code would have to import lots of seemingly unrelated stuff just to get things compiled. In this case it would mean that import nimdata is no longer suffcient and we'd have to document that whenever you import nimdata you also have to import sequtils because of some usage in nim-plotly templates. I'm not quite sure why it worked before though.

For now I have disabled the nim-plotly test parts in NimData to get a green build again (https://github.com/bluenote10/NimData/pull/68).

Vindaar commented 3 years ago

I vaguely remember that sometime in the last year some of the symbol lookup rules regarding templates were changed. So that's probably the reason.

I'll try to fix it with manual mixin added.