Nim is a compiled, garbage-collected systems programming language which has an excellent productivity/performance ratio. Nim's design focuses on efficiency, expressiveness, elegance (in the order of priority).
proc cmp(a, b: string): int
export foobar/utils
will not work.
export "foobar/utils"
import foobar/helpers
export helpers
Hint: /home/ray/Nim/Nim-devel/lib/pure/times_examples [Exec]
times_examples.nim(190) times_examples
system.nim(3803) raiseAssert
system.nim(2857) sysFatal
Error: unhandled exception: toTimeInterval(a) ==
initTimeInterval(0, 0, 0, 10, 0, convert(Seconds, Hours, -dt.utcOffset), 1, 0, 0, 1970) times_examples.nim(190) [AssertionError]
Error: execution of an external program failed: '/home/ray/Nim/Nim-devel/lib/pure/times_examples '
[Examples] failed
Error: execution of an external program failed: '/home/ray/Nim/Nim-devel/tools/nimweb web/website.ini --putenv:nimversion=0.18.1'
FAILURE
template defun*(self, fsym, max_args, body: untyped) {.dirty.} = ## \
## emacs_func(env: ptr emacs_env, nargs: ptrdiff_t,
## args: ptr array[0..max_args, emacs_value], data: pointer):
## emacs_value {.exportc.}
## The `fsym` is registered as the name in emacs and also
## be registered in Nim with nimEmacs prefix.
## If you include "_" in the function name, it will be converted "-"
## in Emacs.
static:
self.pushFunction(astToStr(fsym), max_args)
proc `fsym`*(env: ptr emacs_env, nargs: ptrdiff_t,
args: ptr array[0..max_args, emacs_value],
data: pointer): emacs_value {.exportc,extern: "nimEmacs_" & self.libName & "_$1".} =
body
emacs.defun(return_t, 1):
## Returns ``t``, always.
env.intern(env, "t")
t
, always." and save it to a var inside that template defun
. I plan to pass that as a new argument to that pushFunction
proc.