This is the mail archive of the kawa@sourceware.org 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: case-lambda and Java


On 12/07/2009 03:48 PM, Jamison Hope wrote:
Is there a way to invoke procedures defined with case-lambda from Java?

There's the $Mn$Grlist Location which presumably points to the
case-lambda body, but that's all. I was hoping to find either a family
of overloaded methods (akin to what you get when using #!optional args),

There is a family of non-public methods: lambda1 ... lambdaN, one for each "method" of the lambda-case.

or a single $To$List method which performed the dispatch internally.

Nope. What it does is create a GenericProcedure object, and then dispatch on that depending on argument matching. Using a GenericProcedure is not optimized well, and may be overkill for case-lambda, but that is what is happening ...

The $Mn$Grlist field does hold the value of that GenericProc.
In the current SVN it will probably be an Object rather than
a Location - either way you might consider:

(define-constant ->list :: procedure
  (case-lambda ...))

Then $Mn$Grlist will have type gnu.mapping.Procedure, which
means you can use Procedure's various apply* methods.
--
	--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]