This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: GSOC | Extending Common Lisp support
On 06/02/2012 02:06 PM, Jamison Hope wrote:
That seems to be a difference between running kawa
with or without -f:
$ kawa --diagnostic-strip-directories -f
gnu/commonlisp/testsuite/warnings.lisp
warnings.lisp:1:1: warning - no declaration seen for x
42
$ kawa --diagnostic-strip-directories
gnu/commonlisp/testsuite/warnings.lisp
warnings.lisp:1:1: warning - no declaration seen for x
warnings.lisp:4:8: warning - no declaration seen for x
42
The warning happens if there is no declaration in the
lexical environment *and* there is no binding in the dynamic environment.
In the -f case, evaluating line 1 emits a warning, but after
executing x it gets added to the dynamic environment, which
avoids the warning for line 4. In the non-f case, the file file is compiled
as a unit.
It may be reasonable to change the "no declaration seen for" so it only
happens
once per compilation unit. Perhaps move the warning into the method
FindCapturedVars#allocUnboundDecl, though I'm not sure if that's right.
RunTestScript runs kawa like the latter, so fine, we'll add another
Diagnostic line. But if I then add
(defvar list-of-numbers (list 1 2 3))
(defun list-of-numbers (start end)
(if (> start end)
nil
(cons start (list-of-numbers (1+ start) end))))
(write list-of-numbers)
in order to test the different namespaces, I get this other warning, which
seems like a bug:
warnings.lisp:12:1: warning - duplicate declaration for `list-of-numbers'
Especially considering the full -f/no -f output differences:
$ kawa --diagnostic-strip-directories -f
gnu/commonlisp/testsuite/warnings.lisp
warnings.lisp:1:1: warning - no declaration seen for x
42
warnings.lisp:15:17: warning - no declaration seen for list-of-numbers
warnings.lisp:15:34: warning - no declaration seen for 1+
(1 2 3)
$ kawa --diagnostic-strip-directories
gnu/commonlisp/testsuite/warnings.lisp
warnings.lisp:12:1: warning - duplicate declaration for `list-of-numbers'
warnings.lisp:1:1: warning - no declaration seen for x
warnings.lisp:4:8: warning - no declaration seen for x
warnings.lisp:15:17: warning - no declaration seen for list-of-numbers
warnings.lisp:15:34: warning - no declaration seen for 1+
warnings.lisp:17:8: warning - no declaration seen for list-of-numbers
42
#<procedure list-of-numbers>
That looks like running without -f (as RunTestScript does) just doesn't
work correctly for Lisp2 languages.
Should we change RunTestScript to pass -f, or try to figure out why
it's not respecting the separate namespaces?
The latter. If running without -f doesn't work, then ahead-of-tie
compilation (i.e. -C then) is unlikely to work. So that isn't the fix.
The key method here is Language#getNamespaceOf, and the constants
Language#VALUE_NAMESPACE and Language#FUNCTION_NAMESPACE.
I think we want a duplicate declaration error if and only if
the results of getNamespaceOf have overlapping bits.
It's also worth noting the XQuery also hasSeparateFunctionNamespace,
and the logic works there (though XQuery doesn't have local functions).
--
--Per Bothner
per@bothner.com http://per.bothner.com/