Hi all, does anyone know about any existing extensions to FFI or even to GHC which incorporate access to overloaded methods, which are common in OO environments (.NET, Java), without using "renaming techniques" ? Thanks in advance, -- ________________________________ Monique Louise B.Monteiro Msc Student in Computer Science Center of Informatics Federal University of Pernambuco
Monique Louise wrote:
does anyone know about any existing extensions to FFI or even to GHC which incorporate access to overloaded methods, which are common in OO environments (.NET, Java), without using "renaming techniques" ?
I think you refer here to "overloaded methods" in the sense of methods with the same name in the same class with different argument types (a la Java, or C++).
class C { void foo( Int i ); void foo (Float f ): }
Note that "under the hood" even .NET and Java use different names for each method ("renaming") to distinguish them.
class C { void foo_Int( Int i); void foo_Float( Float f); }
This compiler assigns the unoverloaded name statically once the types of the arguments are known. So, when using such methods from the Haskell FFI, I think you can only call into the unoverloaded names.
foreign import dynamic c_foo_Int :: C -> Int -> IO () foreign import dynamic c_foo_Float :: C -> Float -> IO ()
I guess you can get the overloading again by using the usual Haskell classes:
class C_foo a where c_foo :: C -> a -> IO () instance C_foo Int where c_foo = c_foo_Int instance C_foo Float where c_foo = c_foo_Float
I don't know of any other solution , but you may want to read Andre Pang's master thesis (under supervision of Manuel Chackravarty) that might have some content about this. All the best, Daan Leijen.
Thanks in advance,
Hi, Daan,
Note that "under the hood" even .NET and Java use different names for each method ("renaming") to distinguish them.
perhaps the virtual machine or the JIT compiler use different names to resolve overloads, but the code in .NET MSIL, for example, uses the same name.
I don't know of any other solution , but you may want to read Andre Pang's master thesis (under supervision of Manuel Chackravarty) that might have some content about this.
Do you know where I can find that thesis ? Thanks, Monique Louise B.Monteiro Msc Student in Computer Science Center of Informatics Federal University of Pernambuco
On 20/04/2005, at 8:49 AM, Monique Louise wrote:
I don't know of any other solution , but you may want to read Andre Pang's master thesis (under supervision of Manuel Chackravarty) that might have some content about this.
Do you know where I can find that thesis ?
Here's a paper which is more-or-less a condensed version of my thesis: http://xrl.us/ftux (Link to www.algorithm.com.au) -- % Andre Pang : trust.in.love.to.save <http://www.algorithm.com.au/>
Thanks, Andre ! On 4/20/05, Andre Pang <ozone@algorithm.com.au> wrote:
On 20/04/2005, at 8:49 AM, Monique Louise wrote:
I don't know of any other solution , but you may want to read Andre Pang's master thesis (under supervision of Manuel Chackravarty) that might have some content about this.
Do you know where I can find that thesis ?
Here's a paper which is more-or-less a condensed version of my thesis:
http://xrl.us/ftux (Link to www.algorithm.com.au)
-- % Andre Pang : trust.in.love.to.save <http://www.algorithm.com.au/>
-- ________________________________ Monique Louise B.Monteiro Msc Student in Computer Science Center of Informatics Federal University of Pernambuco
Monique Louise wrote:
Hi, Daan,
Note that "under the hood" even .NET and Java use different names for each method ("renaming") to distinguish them.
perhaps the virtual machine or the JIT compiler use different names to resolve overloads, but the code in .NET MSIL, for example, uses the same name.
Ah yes, but that is because the .NET system still maintains types, ie. the JIT resolves them in the end. So, if you want to call a .NET overloaded function, you also need to pass the types of the arguments (which is just as complicated as "renaming"). I guess that from the Haskell side, you still need to have unique names for each overloaded version and use the class system to resolve them. Maybe you can do with a single version where you pass the types of the arguments too? Maybe with Dynamic of Equality data types from [1]? All the best, -- Daan [1] Arthur Baars and Doaitse Swierstra, "Typing Dynamic Typing"
I don't know of any other solution , but you may want to read Andre Pang's master thesis (under supervision of Manuel Chackravarty) that might have some content about this.
Do you know where I can find that thesis ?
Thanks,
Monique Louise B.Monteiro Msc Student in Computer Science Center of Informatics Federal University of Pernambuco _______________________________________________ FFI mailing list FFI@haskell.org http://www.haskell.org/mailman/listinfo/ffi
participants (3)
-
Andre Pang -
Daan Leijen -
Monique Louise