Skip to content
Ilya Sher edited this page Jan 11, 2024 · 1 revision

This page describes rough edges in NGS which the user should be aware of.

Missing "global" in a namespace

ns {
  type T
  F each(t:T, cb:Fun) ...

  [1,2,3].each(echo)
}

[1,2,3].each(echo) will fail with MethodNotFound exception. Unfortunately it's not easy to understand what's going on. The issue is that each is now local to ns. The code above should actually be:

ns {
  type T
  global each
  F each(t:T, cb:Fun) ...

  [1,2,3].each(echo)
}

A hint to understanding the situation should be MethodNotFound exception with something like:

...
[ERROR 2024-01-11 22:22:54 +04] Info: callable:
[ERROR 2024-01-11 22:22:54 +04]   (root) - MultiMethod
[ERROR 2024-01-11 22:22:54 +04]   .Arr() - Arr of size 1
[ERROR 2024-01-11 22:22:54 +04]   .Arr()[0] - <UserDefinedMethod each(t:T, cb:Fun) at ...>
[ERROR 2024-01-11 22:22:54 +04]   .Arr()[0].meta().name = String of length 4: each
...

... where you can see that the expected echo implementation is absent while the one(s) defined in the ns are present.