This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Confusing error message
On 04/15/2011 09:57 AM, Charles Turner wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 15/04/11 03:28, Per Bothner wrote:
Kawa has a mechanism for this: It has the method
Language#formatType, which takes a type and returns a
language-appropriate name.
This doesn't seem right from my rather brief investigation, the
formatType method calls Type#getName which returns a fully qualified
name, what we don't want.
It can be overridden on a per-language basis - see Scheme.formatType.
I've also found some holes in argument checking, which I'll put on my
todo list, such as,
#|kawa:2|# (map '(1 2 3) '(1 2 3))
java.lang.IndexOutOfBoundsException
I'd prefer Kawa to say something like "expected a procedure but was
given a list", embellished to taste, of course.
Agreed.
It may have to dynamically look for the "current Language"
or it could use the "language used to compile the current class".
Don't understand this at the moment, need to look into how this all
works a little further.
Language#formatName is an instance method (not static), so it needs an
appropriate Language instance. But what is the appropriate Language
if a situation where people might be mixing languages? Is the current
language a dynamic property, or does it depend on the language calling
cdr? The latter might be more correct, but for now I'd just use
Language.getDefaultLanguage.
'cdr' called with argument #1 (value: (), type: empty-list) but expected
'pair' (The "expected 'pair'" is a bit trickier with generic or overloaded
functions.)
I like that, I probably don't fully appreciate the implications of the
parenthesised comment.
When you have overloaded methods, or a GenericProc (which is generic in the
Lisp sense, not the Java sense) you don't necessarily have an "expected
type",
--
--Per Bothner
per@bothner.com http://per.bothner.com/