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
Sun, 21 Jan 2007 22:14:35 -0500


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.  You can  
even write:

api MyBigFn

MyFn(a:ZZ):Boolean
MyFn(b:Boolean):Boolean

end


component Collections
export {MyFn, MyBigFn}

MyFn(a:ZZ):Boolean = false
MyFn(b:Boolean):Boolean = true

end


And now Collections satisfies either api; if you import MyFn and link  
to Collections, you get just the first definition, but if you import  
MyBigFn and link to Collections you get both definitions.

-Jan

>
> Mike Atkinson
> _______________________________________________
> Fortress-interest mailing list
> Fortress-interest@experimentalstuff.com
> http://www.experimentalstuff.com/mailman/listinfo/fortress-interest



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