This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Warning elimination


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]