This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Warning elimination
- From: Per Bothner <per at bothner dot com>
- To: Adam Warner <lists at consulting dot net dot nz>
- Cc: kawa at sources dot redhat dot com
- Date: Sat, 17 Apr 2004 22:18:45 -0700
- Subject: Re: Warning elimination
- References: <1082192020.2032.102.camel@work.consulting.net.nz>
Adam Warner wrote:
It appears I need to declare the input type of argument `file' as
<string> or <java.io.File>, and I don't believe that declaring types as
sets are supported in Kawa.
You mean 'declaring types as unions'. It is currently not implemented,
however union types will be needed to implemented "the static typing
feature" of XQuery, at which point it might be reasonable to also
support them for Scheme.
(define (file-date file)
(let ((object (cond ((string? file)
(make 'java.io.File file))
((eq? (java.lang.Class:getName
(java.lang.Object:getClass file))
'java.io.File)
file)
(else (error "file-date; illegal type:" file)))))
(java.io.File:lastModified object)))
It might be reasonable to implement a "typecase" or "typeswitch"
construct, like both Common Lisp and XQuery have. Since we already
supports typeswitch for the XQuery language, it's just a "small matter
of programming" to implement typecase for Scheme. But don't expect
it anytime soon!
Chris Dean wrote:
> It probably a bug that this message isn't controlled by the
> --no-warn-invoke-unknown-method option.
I tend to agree. I checked in a patch to fix this.
However, I do recommend not using this switch, so you can fix your
code when Kawa has to use (very inefficient) run-time reflection.
--
--Per Bothner
per@bothner.com http://per.bothner.com/