As far as I understand the include statement includes the content of the file.
But the example below doesn't work that way, there's the difference if the content of the base.nim - typed manually (script works) or included via include statement (doesn't work).
Why?
# main.nim
# include base
import system except find
import mylib, sugar, options
echo @[1, 2, 3].find((v) => v == 2).get
# base.nim
import system except find
import mylib, sugar, options
# mylib.nim
import system except find
import options, sugar
func find*[T](list: openarray[T], check: (T) -> bool): Option[T] =
for v in list:
if check(v): return v.some
T.none
Is such code import system except find - not supported, or is it against the coding conventions?
P.S.
I'm not using Nim's standard library and coding conventions, using different ones.
Because in my case Nim is used along with TypeScript and Kotlin - and all 3 languages are using customised and similarly looking libraries and coding conventions, so code in all 3 languages looks alike.
Is such code
The related thread was (you started it): https://forum.nim-lang.org/t/6849
In the past we were told "we should never import module system directly." But from the post of Mr Blake
https://forum.nim-lang.org/t/6849#42817
it may work now.
Yes, and I was using the advice from that tread since. I asked it again because of this answer
Dont import system
I was not sure why I shouldn't use it if it's works. If it's against coding conventions and may break some random library (which is ok for me), or if it's not supported and somehow working now but may not work in the future.
Use Nim coding conventions.
You mean conventions like that one sum(toSeq(table.values))?
Thanks no.