Allow more easily importing modules from custom directories
without jumping through too many hoops. Technically, this was
possible before but required circumventing the built-in module/paths
and was just a hassle.
Also add entries to module/path (and module/add-path) to allow code
like the following.
(setdyn :my-libs "/home/me/janet-stuff/")
(import @my-libs/toolbox)
Intended for things like test harnesses where code might not
be installed to the usual directories.
This allows a configuration workflow that is a bit simpler than before
and doesn't requiring applying patches. Instead, add a config.mk to
source dir with JANETCONF_HEADER=myconfig.h and compile as usual.
The patching workflow will of course still work exactly as before.
In C, signed arithmetic overflow is undefined behvior
but unsigned arithmetic overflow is twos complement
Unconditionally switch to unsigned arithmetic internally for +, -, *
This will not affect the result thanks to twos complement awesomeness.
I don't think this will be an issue in these functions,
but it has a history of causing bugs.....
Three reasons:
1. This same behavior is not documented on the `next` function
2. This function does not throw the error directly,
it only throws an error because `next` does.
3. Following the same idea as the previous commit, this behavior is
more or less implementation-defined for nonsensical types
> In dynamic languages, the usual idea is garbage in, garbage out.
Various other documentation cleanup.
> Remove the try. In dynamic languages, the usual idea is garbage in, garbage out. You misunderstood my point about the type error. “Test” functions are not special in that regard.
> - @bakpakin
This is just documentation of existing behavior, it does not change anything.
The reason index-of throws a type error on non-iterable types is because `next` does.
This is hardcoded into the JOP_NEXT opcode (see src/core/value.c:janet_next_impl).
Unfortunately, there is currently no corresponding `iterable?` check.
Note this actually changes behavior from a thin wrapper over `index-of`.
This is because `(index-of 3 3)` throws "error: expected iterable type, got 3"