Sun Microsystems Laboratories Experimental Stuff [Fortress-interest] exporting overloaded functions from an API

[Fortress-interest] exporting overloaded functions from an API

Jan-Willem Maessen Janwillem.Maessen@sun.com
Mon, 22 Jan 2007 13:29:50 -0500


On Jan 21, 2007, at 10:14 PM, Jan-Willem Maessen wrote:

>
> On Jan 21, 2007, at 12:59 PM, Mike Atkinson wrote:
>
>> component Collections
>> export {MyFn}
>>
>> MyFn(a:ZZ):Boolean = false
>> MyFn(b:Boolean):Boolean = true
>>
>> end
>>
>>
>> do both function definitions get exported? Is it possible to  
>> export only  one?
>
> Actually, that depends on what you've declared in the api MyFn.   
> The export list lists apis, not functions.  So if you wrote:
>
> api MyFn
>
> MyFn(a:ZZ):Boolean
>
> end
>
> then only the first of the two definitions will be exported.


I should clarify at this point that this is looking ahead rather.  If  
you read the 1.0alpha spec, you'll quickly learn that we are required  
to export the entire function, as in the MyBigFn api:

> api MyBigFn
>
> MyFn(a:ZZ):Boolean
> MyFn(b:Boolean):Boolean
>
> end

This avoids some problems which crop up should your api slice your  
multiple-inheritance trait hierarchy in a different direction than  
your overloaded function declarations choose to.  My hope is that we  
can address those problems and eventually permit narrower apis like  
the MyFn api above.

That said, the interpreter doesn't implement components and apis yet;  
that's been a big focus of recent attention.

-Jan




This page is: http://www.experimentalstuff.com/pipermail/fortress-interest/2007-January/000099.html
Last Modified: Tue, 30 Jan 2007 19:35:03 GMT
copyright (c) 2000-2009, Sun Microsystems