Arc Forumnew | comments | leaders | submitlogin
Esoteric questions about ac.scm implementation
3 points by kens 6277 days ago | 3 comments
I've been looking at ac.scm, and I'm confused by a few things in the internals of the implementation:

a) Why does Arc terminate lists with the symbol 'nil instead of '()?

b) namespace-set-variable-value!: How is this different from define? (The PLT manual just confuses me.)

c) (list 'quote 'nil): isn't this just a verbose way of saying ''nil or (quote 'nil)?

d) `(ar-funcall0 ,(ac fn env) ,@(map (lambda (x) (ac x env)) args): This is generating Scheme code which is later passed to eval, which seems like a macro, but it's not using Scheme macros. Could this use "real" macros? Or is this a "real" macro? Does it matter?

e) (eval scm (interaction-environment)): Why use interaction-environment? (R5RS leaves me more confused than before.)

One interesting discovery: entering :a at the REPL will drop you from Arc into Scheme; (tl) will then return you to Arc.



1 point by shiro 6277 days ago | link

e) In R5RS Scheme you have to specify the global environment where the expression is eval'ed, but it only specify three envirionments, two of which are very restricted. So, using (interaction-environment) is the easiest way to get the behavior of legacy 'eval'. Various implementations extend this part of semantics, but you'll lose portability. Cf. http://practical-scheme.net/wiliki/schemexref.cgi?eval

-----

1 point by soegaard 6277 days ago | link

ad b) Namespaces are first class objects. Hence the need for namespace-set-variable-value!

-----

1 point by almkglor 6277 days ago | link

a.) Because that's how lisp originally did it - nil == ().

c.) Yes, it appears to be so.

-----