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: What is the use of (require <xyz>) and explicit type declarations?


Hoehle, Joerg-Cyril wrote:

Furthermore, why does there seem to be a need for top-level type declarations (still in the context of file-compilation)?
I thought that the compiler had enough information from the code and was using
reflection abilities (e.g. obtaining the result type from 'getinstance) to
infer the resulting type of keystore?

One issue is the "implementation type" of keystore. I.e. what is the Java type of 'keystore' Java field that Kawa creates. I think it might cause difficulties if the Java type depends on the value it is initialized to. It would cause binary compatibility breakage. Plus it be difficult to specify in the case of recursive modules, which one day I hope to support.


A separate but related issue is whatever information about types the compiler has that it can use for error/warning messages or code optimization. For this the compiler could/should bed able to suppress the error message in this case.

For now, the aspects are somewhat tied together, though Kawa does support "pseudo-types" that have a separate implementation type.

Similarly for embedded calls, e.g.
(define (get-subject-name keyinfo :: <org.apache.xml.security.keys.KeyInfo>)
  (and
   (invoke keyinfo 'containsX509Data)
   (let ((x509-data (invoke keyinfo 'itemX509Data 0)))
     (and
      (invoke x509-data 'containsSubjectName)
      (invoke (invoke x509-data 'itemSubjectName 0)
	      'getSubjectName)))))
re-sign.scm:248:6: warning - no method `containsSubjectName' in java.lang.Object
re-sign.scm:250:8: warning - no method `getSubjectName' in java.lang.Object
re-sign.scm:250:16: warning - no method `itemSubjectName' in java.lang.Object

I believe the CVS version of Kawa handles these better. However, I haven't tried this specific piece of code.


Similarly, what is the recommended way of avoiding warnings in conjunction
with nested calls, e.g.

Try of CVS Kawa. (I know this is difficult for some. If I can squeeze in the time, I might do a kawa 1.7.90 interim/beta release soon; if not I will have time to do a kawa 1.8 release after my Apple contract ends December 15.


I believe the compiler should know the return type of
(invoke oldsigelem 'getParentNode), shouldn't it?

Yes, and I believe it does.


Must I really add a (IMHO redundant) type declaration to oldsigelem?

For now, you probably do.


BTW, would you prefer full code so as to be able to execute it from my e-mails?

The ideal is short but standalone (complete) code. -- --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]