Wait, so is the haxe binding support for writing Haxe code from
MonoDevelop?
Ideas running through my mind...
1.) Using NME C++ libraries with C#
I always had good experiences working with C# in terms of integration with
Windows. System tray icon? Custom forms and windows? Simple. This is a bit
more difficult from C/C++, but if NME's C++ binary could be loaded and
used from C#, that means the windowing could be handled in C#, and with a
haxe C# target, it could all be invisible to the user, and just handled
all through haxe code. Seems very cool, potentially.
2.) Some kind of Windows Phone target?
Windows Phone has not allowed the use of unmanaged C/C++ code, which has
shot down the possibility of an NME target for the platform. However, with
a haxe C# target, it opens the possibility of running on Windows Phone.
Though it would be a bit of work, a C# target could mean the beginnings of
NME-style support for Windows Phone, or maybe even XBox Live?
3.) IDE support/creation
The last thing that's firing in my head is either the support of Haxe in
MonoDevelop, or if a haxe C# target would make it easier to generate
anything new. We all know that FlashDevelop is an awesome *Windows* IDE,
written in C#, and as much as everyone has asked for a Linux or Mac port,
no one has made it happen. If you have haxe working as a language inside
of MonoDevelop, it may be possible to pull (or share) components from
FlashDevelop and use them in MonoDevelop, or spin things off to make a
FlashDevelop derivative, (perhaps) using cross-platform controls from
MonoDevelop. One of the biggest "gotchas" to porting FlashDevelop has been
Scintilla.NET, but if MonoDevelop's text editor control was used instead,
it might be possible to have an original IDE, basically FlashDevelop, but
using MonoDevelop parts where necessary.
On Wed, 04 Jan 2012 22:40:48 -0800, Ben Cooley <benjc...@gmail.com>
wrote:
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
> --
> To post to this group haxe...@googlegroups.com
> http://groups.google.com/group/haxelang?hl=en
--
Philippe
--
Philippe
I'd understand it might be covered by NDA stuff, but is your company
generally interested in haxe?
Wow, great job!!!
I've been working on the C# target for some time now (actually I'm
past my due time for a release!), and I'm happy to see you've nailed
it.
I haven't been able to look very deeply into it, but it seems that
you're compiling to C# 4.0 with the dynamics support. I chose not to
use the dynamic support of C# for some reasons. Specially because it
uses the DLR which needs to generate assemblies on the fly. This
actually rules out most if not all mobile platforms, as they have a
restricted access to dynamic code generation, and also I think
restricts the use of XNA and Unity.
But I really intended to later support code generation for C# 4.0
using a compiler flag to use the 'native' dynamics, as in some cases
the generated code will be smaller (despite the DLR footprint), and
maybe faster. We can maybe join our code bases so to add an option to
generate code for C# 4.0 + dynamics?
I'm not sure about the speed gain, when I've done some preliminary
benchmarks I found that the way I'm doing reflection is actually
faster, but maybe if you don't change the object reference many times
(which is slow in the DLR as it has to re-generate the bind code), it
might be faster.
I've also seen that you're using Func<> for delegates. Is that right?
There are some difficult problems to solve about using Func<> for
function signatures, even though I don't know if dynamic will be of
help in this case (as I said earlier, my target platform is C# 2.0
without any extension)
The problem is with how Dynamic works in haxe for function types:
Suppose you have a function : var fun = function(a:Int, b:Int) return a + b;
this function can have the following signatures in haxe:
Int->Int->Int
Dynamic->Int->Int
Dynamic->Dynamic->Int
Dynamic->Dynamic->Dynamic
and so on..
I'm not sure if you can cast from Func<int,int,int> to
Func<dynamic,int,dynamic> for example, but I think you can't, so you
might run into some problems there.
The same goes for Type parameters. In C# you can't cast from
Array<object> to Array<int>, for example (and vice versa). Casting
from Array<object> to Array<int> might be needed for e.g.
Serialization, while casting from Array<int> to Array<object> (or
Array<dynamic>) is needed for
Also you might run into some problems with Null<T> type, which most of
the time just means the same as T, but not when T is a basic type. The
obvious solution would be to use it as Nullable<T>, but Nullable<T>
has a constraint where T must always be a basic type. What I've done
was to create a new struct Null<T>, and then detect all implicit
casting between T and Null<T> and vice-versa and make a real cast.
This gave me more work than I bargained for, specially because
sometimes it's really tricky to catch some implicit casting.
Well, you can see most of the solutions I've come up for these
problems in my last year presentation at haxecon here
http://prezi.com/xzvht0y2e-c6/haxe-java-c/ . I'm very close to have
the C# 2.0 target fully working, and the good news is that I've done
90% of the work by manipulating the AST (which actually was an
insanely slow way to code, but Java and C# will be able to share most
of their code), so maybe you can e.g. use how I implemented anonymous
functions and expression unwrap and still use your own implementation
for the rest (actually you wouldn't need to change almost anything in
your code to do that).
What do you think?
Congratulations! And cheers!
Cauê
2012/1/5 Ben Cooley <benjc...@gmail.com>:
yeah, rightyho, i think i was just asking about debugging on the
list(s) but only heard crickets. :-(
Also, AFAIK haxe's type parameters are invariant, meaning I think a
cast from any Array<x> to any Array<y> is not allowed unless the haxe
compiler actually permits this in violation of it's own semantics.
I've had a project waiting in the wings for several months now waiting
for a .NET target, so I'm excited to give it a whirl. My target
platform is a desktop, though I need to do more research before I know
which version of C# I need. In any case, thanks for getting this out.
I'm looking forward to getting started.
Cheers,
JHL
I think that one important thing to plan for the future (once solved all
the small issues) would be to target CIL instead of C#, this would allow
exact mapping of .hx files positions and I guess remove the expr VS
statements issues.
Best,
Nicolas
I think that one important thing to plan for the future (once solved all the small issues) would be to target CIL instead of C#, this would allow exact mapping of .hx files positions and I guess remove the expr VS statements issues.
It's planned to be a mirror of haXe SVN, not the main repo yet. I might
still accept patches through it. I'm still having issues importing the
whole SVN history into it.
Best,
Nicolas
Yes, please do accept pull requests through Github.
JHL
Sadly on most platforms we don't know the actual generic type. It might
even not be an actual value (structure or function type for instance).
Best,
Nicolas
What could be done however is to unserialize the first item for standard
containers (Array/List/Hash/IntHash) and create the container based on
this type. That would need additional code also in case the first type
is too much precise (such as [new B(),new A()]).
Then when transforming a Dynamic value into generic instance, you can
check if the type is already correct and if it's not perform a
conversion. That seems reasonable to me.
Best,
Nicolas
this calls for a sample :)
How do you use the source debugging? Debugging in VS?
> --
> To post to this group haxe...@googlegroups.com
> http://groups.google.com/group/haxelang?hl=en
--
Philippe
Would it be possible for you to provide the haxe binary file needed to
compile for the C# target ?
At least the windows haxe.exe would be of great help.
Raph
2012/1/26 Ben Cooley <benjc...@gmail.com>:
That's very nice to see two people (you and Caue) working on C# target,
I hope you will be able at some point to merge both of your efforts so
we can have one single official C# code generator as part of the haxe
standard distribution, with two potential contributors / bug fixers :D
Best,
Nicolas
I've implemented a Haxe C# target, available at git://github.com/benjcooley/haxe.git.To run-test the target, you'll need to clone the haxe-install repo's gencs branch, then make sure that the git line in the install.ml file will correctly pull the "gencs" haxe branch from my repo during build.I have not successfully run the haxe unit test suite on this target, but basic features seem to be working. One addition is support for generating #line directives in the output code via the -lines compiler option to allow source debugging in haxe when running on the .net VM.There is also a preliminary "haxe" Binding for MonoDevelop in the MonoDevelop repo.My primary interest in this port is to allow Haxe to target mobile devices in a way that allows easy access to the native platform, better GC behavior, and full IDE tooling support including source level debugging on both simulator and devices. It seemed to me that being able to target Mono was the easiest path to reach this goal.