#1702 .NET FFI

rudimk Wed 16 Nov 2011

Hi!

Just curious - when exactly would Fantom have a functional .NET FFI? If no roadmap is defined, then I might just try and do it myself, although I'm not sure how I would start. Your help would be great!

Regards, Rudi.

brian Wed 16 Nov 2011

Hi Rudi,

Welcome to Fantom.

At this point the .NET runtime is really a proof of concept. I maintain the core sys code (for example all the recent bug fixes and API changes were incorporated into the C# code base). But I wouldn't classify the .NET runtime as production ready, it still has a long way to go. So before even discussing the .NET FFI, we'd have to consider the .NET runtime itself.

Once we had a solid .NET runtime, then the FFI step would really be to just duplicate the patterns used by the compilerJava pod. You'd have a compilerDotnet::DotnetBridge that registered on the compiler.bridge.dotnet which would then give the .NET FFI control of the [dotnet] type namespace.

rudimk Wed 16 Nov 2011

Hey Brian!

I've been following Fantom since 2009 - wrote a small missile defence system simulator using it. But being a .NET guy through and through, I'll be honest - I didn't use it much.

But lately, with languages like Scala and Clojure supporting both the JVM and the CLR, I guess Fantom should, too. The language design is beautiful, and once it runs on the CLR, I can see many C# devs migrating over to Fantom - myself included!

Now, I'm a tad confused. What exactly do you mean by .NET runtime? I'm not too familiar with Fantom's architecture, so is this runtime you're referring to, a part of Fantom?

brian Wed 16 Nov 2011

Now, I'm a tad confused. What exactly do you mean by .NET runtime?

A "runtime" for Fantom is defined as "native" code which implements:

  • sys pod
  • ability to load and execute fcode
  • implementation of native methods for pods such as inet, concurrent, util, fwt

For example there is a implementation of sys::DateTime in Java, C#, and in JavaScript.

Likewise pieces of fwt::Widget require implementation glue in Java, C#, and JavaScript peers.

C# has an implementation for most of sys, but not complete. It has an out-dated implementation for inet and concurrent, and nothing for fwt. If you run this command you can see what works and does not work in .NET:

fant --Druntime=dotnet testSys

Take a look in src/sys/dotnet to see how it works.

rudimk Wed 16 Nov 2011

Ah. I get it now. Okay. Lemme take a day or two, and see how I work on this. I'll keep you posted. Thanks :)

Login or Signup to reply.