~rlb/lokke

ns: fix syntax expansion scoping issues

Previously ns was picking up refer (at least) indirectly (and
incorrectly), but recent guile changes fixed that, which caused builds
fail like this:

  ERROR: In procedure %resolve-variable:
  In procedure module-lookup: Unbound variable: refer

Rework the expansion to refer to the correct refer, and adjust other
ns directives to produce syntaxes rather than datums.

cf. 9e0f03c5fd36764827c8bb03887f14640c883b70

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
amap: use array-copy, not aclone (latter isn't actually in module)

aclone is just a re-export of array-copy

cf. 9e0f03c5fd36764827c8bb03887f14640c883b70

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke array: don't export aget (it's an array-ref re-export)

cf. 9e0f03c5fd36764827c8bb03887f14640c883b70

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
ns: when debug-ns? print ns syntax and form

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Prefer simple-format

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke reader: use simple-format or string-append where we can

It's been suggested simple-format performs better, and we don't need
always/often need the full format.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke core: make #:pure and clean up imports/exports

Make #:pure so (guile) #:select doesn't undermine #:hide, and
synchronize the #:hide list with the replacements, etc.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke base dynamic, lokke base invoke, lokke collection: make #:pure

Make #:pure so (guile) #:select doesn't undermine #:hide, and
synchronize the #:hide list with the replacements.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke symbol: make #:pure; #:hide gensym and symbol

Make #:pure so the (guile) #:select doesn't undermine #:hide, and hide
gensym and symbol since we're defining new ones.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke pr: make #:pure; hide format newline; include ports fns

Make #:pure so the (guile) #:select doesn't undermine #:hide, and hide
newline and format since we're defining new ones.  Explicitly select
the relevant (ice-9 ports) functions because they're not
currently (3.0.9) added when you use the (guile) module (and they are
missing from the (guile) public interface at the moment).

Thanks to Andy Wingo for helping me track that down.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke exception: make #:pure; hide throw

Make #:pure so the (guile) #:select doesn't undermine #:hide and hide
throw since we're defining a different one.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke base collection: make #:pure; hide assoc and list?

Make #:pure so the (guile) #:select doesn't undermine #:hide, and then
remove the related assoc hack.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke base syntax: make #:pure; fix (guile) imports; drop %scm-let

Make #:pure so the (guile) #:select doesn't undermine #:hide.  Sync
the #:hide and #:replace lists.  Drop %scm-let in favor of let, since
this file already intends to and does rely on scheme let (which is why
it defines let** instead and then renames it on export).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke core: selectively import (lokke hash-set) bindings

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke core: selectively import (lokke vector) bindings

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lokke vector: hide apply too; make #:pure

Guile's apply shouldn't be available since we're augmenting lokke's,
and make the module #:pure so we'll onlg have the bindings we select.
Without #:pure, all the (guile) exports will still be available,
including apply.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
re-export-and-replace!: convert to #:re-export-and-replace

The former was only needed to support guile versions before 3.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Don't add doc property to fns we didn't create

Also mentioned, but not included in
bb7d71dcf949fd377652136480fe65a1bc698603

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Only define doc for the repl, not in lokke.user

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Overhaul doc

Find and report the namespace where the variable is defined, rather
than the current namespace, and resolve aliases, i.e. report
clojure.string/join for (doc join) after a refer, or (doc str/join)
given an alias, etc.

Let guile handle the docs.  Instead of maintaining lokke-specific docs
in the hidden /lokke/doc map, just set a variable 'documentation
property that guile's object-documentation will find, but since that
function currently has aliasing problems, use it selectively for
now (see the comments in (lokke base doc).

Don't mutate procedure documentation properties unless we created the
procedure.

In doc, don't try to evaluate the value directly.

Don't wrap the docs.  It looks like clojure/jvm doesn't, and doing so
mangles guile snarfed docs like (doc guile/assoc).  Just put two
spaces in front of the first line as it appears the jvm does.

Thanks to Z572 for proposing some related changes that led to the
discovery of these issues.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Next