nim-plotly icon indicating copy to clipboard operation
nim-plotly copied to clipboard

attempting to call undeclared routine: 'mapIt'

Open bluenote10 opened this issue 4 years ago • 3 comments

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?

bluenote10 avatar Jul 19 '20 16:07 bluenote10

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

Vindaar avatar Jul 19 '20 17:07 Vindaar

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).

bluenote10 avatar Jun 09 '21 08:06 bluenote10

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.

Vindaar avatar Jun 09 '21 08:06 Vindaar