www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - .NET from D

reply "John C" <johnch_atms hotmail.com> writes:
At least a couple of people were interested in using .NET from D. The 
attached example shows one way of doing it, without hosting the CLR.

Here's a taster:

    _ArrayList arrayList = ArrayList.createObject!(_ArrayList);
    ICollection collection = com_cast!(ICollection)(arrayList);
    int index;
    collection.add(VARIANT(12345), index);

    VARIANT v;
    collection.get_Item(index, v);
    writefln(v.lVal);

Note that the attached files include only the bare minimum to get the 
example to run. I've not defined all the CLR types and some are merely 
placeholders. I've only tested this with .NET 2.0 (but it should work with 
1.0/1.1).

Enjoy. 
Nov 25 2005
next sibling parent reply Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
John C wrote:
 At least a couple of people were interested in using .NET from D. The 
 attached example shows one way of doing it, without hosting the CLR.
 
 Here's a taster:
 
     _ArrayList arrayList = ArrayList.createObject!(_ArrayList);
     ICollection collection = com_cast!(ICollection)(arrayList);
     int index;
     collection.add(VARIANT(12345), index);
 
     VARIANT v;
     collection.get_Item(index, v);
     writefln(v.lVal);
 
 Note that the attached files include only the bare minimum to get the 
 example to run. I've not defined all the CLR types and some are merely 
 placeholders. I've only tested this with .NET 2.0 (but it should work with 
 1.0/1.1).
 
 Enjoy. 
 

Very very interesting, i didn't know it was possible. But IMO too hard to use in real life.
Nov 25 2005
parent "John C" <johnch_atms hotmail.com> writes:
"Ivan Senji" <ivan.senji_REMOVE_ _THIS__gmail.com> wrote in message 
news:dm7vvr$1njo$1 digitaldaemon.com...
 John C wrote:
 At least a couple of people were interested in using .NET from D. The 
 attached example shows one way of doing it, without hosting the CLR.

 Here's a taster:

     _ArrayList arrayList = ArrayList.createObject!(_ArrayList);
     ICollection collection = com_cast!(ICollection)(arrayList);
     int index;
     collection.add(VARIANT(12345), index);

     VARIANT v;
     collection.get_Item(index, v);
     writefln(v.lVal);

 Note that the attached files include only the bare minimum to get the 
 example to run. I've not defined all the CLR types and some are merely 
 placeholders. I've only tested this with .NET 2.0 (but it should work 
 with 1.0/1.1).

 Enjoy.

Very very interesting, i didn't know it was possible. But IMO too hard to use in real life.

Quite. And indeed it is rare. But reasons do exist for wanting to run CLR code from unmanaged apps. There are some fairly large products that do so - Microsoft Office, SQL Server, Viruoso, DB2 and of course Visual Studio.
Nov 26 2005
prev sibling next sibling parent reply Chris <ctlajoie yahoo.com> writes:
On Fri, 25 Nov 2005 17:44:32 -0000, "John C" <johnch_atms hotmail.com>
wrote:

At least a couple of people were interested in using .NET from D. The 
attached example shows one way of doing it, without hosting the CLR.

Here's a taster:

    _ArrayList arrayList = ArrayList.createObject!(_ArrayList);
    ICollection collection = com_cast!(ICollection)(arrayList);
    int index;
    collection.add(VARIANT(12345), index);

    VARIANT v;
    collection.get_Item(index, v);
    writefln(v.lVal);

Note that the attached files include only the bare minimum to get the 
example to run. I've not defined all the CLR types and some are merely 
placeholders. I've only tested this with .NET 2.0 (but it should work with 
1.0/1.1).

Enjoy. 

very nice proof of concept. I know others have various reasons for wanting to, but I personally have no interest in using .NET classes in D. I am however very interested in compiling D (there would have to be some slight deviations in the syntax) directly to MSIL. In fact I'm reading up on compiler design and experimenting with a toy language I created that compiles to MSIL. Soon hopefully I will understand enough to begin writing one for D. Chris
Nov 25 2005
next sibling parent Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
Chris wrote:
 I am however very interested in compiling D (there would have to be
 some slight deviations in the syntax) directly to MSIL. In fact I'm
 reading up on compiler design and experimenting with a toy language I
 created that compiles to MSIL. Soon hopefully I will understand enough
 to begin writing one for D.
 

Cool! Can't wait! :)
Nov 26 2005
prev sibling next sibling parent reply Manfred Hansen <manfred toppoint.de> writes:
Hello,

i found this link
https://mywebspace.wisc.edu/daaugustine/web/d/
from Deja Augustine

Manfed


Chris wrote:

 On Fri, 25 Nov 2005 17:44:32 -0000, "John C" <johnch_atms hotmail.com>
 wrote:
 
At least a couple of people were interested in using .NET from D. The
attached example shows one way of doing it, without hosting the CLR.

Here's a taster:

    _ArrayList arrayList = ArrayList.createObject!(_ArrayList);
    ICollection collection = com_cast!(ICollection)(arrayList);
    int index;
    collection.add(VARIANT(12345), index);

    VARIANT v;
    collection.get_Item(index, v);
    writefln(v.lVal);

Note that the attached files include only the bare minimum to get the
example to run. I've not defined all the CLR types and some are merely
placeholders. I've only tested this with .NET 2.0 (but it should work with
1.0/1.1).

Enjoy.

very nice proof of concept. I know others have various reasons for wanting to, but I personally have no interest in using .NET classes in D. I am however very interested in compiling D (there would have to be some slight deviations in the syntax) directly to MSIL. In fact I'm reading up on compiler design and experimenting with a toy language I created that compiles to MSIL. Soon hopefully I will understand enough to begin writing one for D. Chris

Nov 26 2005
parent reply Chris <ctlajoie yahoo.com> writes:
On Sat, 26 Nov 2005 11:03:07 +0100, Manfred Hansen
<manfred toppoint.de> wrote:

Hello,

i found this link
https://mywebspace.wisc.edu/daaugustine/web/d/
from Deja Augustine

Manfed

Nice find! I don't want to get the old framework just to decompile that. I was able to look at the class structure in it though and it looks like he took the D frontend and changed for his compiler. Chris
Nov 26 2005
parent J C Calvarese <technocrat7 gmail.com> writes:
In article <ob9ho1hm8snvtl520anft0ei7p39bnkcvn 4ax.com>, Chris says...
On Sat, 26 Nov 2005 11:03:07 +0100, Manfred Hansen
<manfred toppoint.de> wrote:

Hello,

i found this link
https://mywebspace.wisc.edu/daaugustine/web/d/
from Deja Augustine

Manfed

Nice find! I don't want to get the old framework just to decompile that. I was able to look at the class structure in it though and it looks like he took the D frontend and changed for his compiler. Chris

Right. My understanding is that his compiler code was based on Walter's fontend. jcc7
Nov 26 2005
prev sibling next sibling parent reply "John C" <johnch_atms hotmail.com> writes:
"Chris" <ctlajoie yahoo.com> wrote in message 
news:h83go15mparb57e1f5d7uroprpo13seb0f 4ax.com...
 On Fri, 25 Nov 2005 17:44:32 -0000, "John C" <johnch_atms hotmail.com>
 wrote:

At least a couple of people were interested in using .NET from D. The
attached example shows one way of doing it, without hosting the CLR.

Here's a taster:

    _ArrayList arrayList = ArrayList.createObject!(_ArrayList);
    ICollection collection = com_cast!(ICollection)(arrayList);
    int index;
    collection.add(VARIANT(12345), index);

    VARIANT v;
    collection.get_Item(index, v);
    writefln(v.lVal);

Note that the attached files include only the bare minimum to get the
example to run. I've not defined all the CLR types and some are merely
placeholders. I've only tested this with .NET 2.0 (but it should work with
1.0/1.1).

Enjoy.

very nice proof of concept. I know others have various reasons for wanting to, but I personally have no interest in using .NET classes in D. I am however very interested in compiling D (there would have to be some slight deviations in the syntax) directly to MSIL. In fact I'm reading up on compiler design and experimenting with a toy language I created that compiles to MSIL. Soon hopefully I will understand enough to begin writing one for D. Chris

It would seem there are several people in this group doing the same thing - would it not make sense to join forces to get a fully functional D.NET compiler out the door?
Nov 26 2005
next sibling parent Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
John C wrote:
 It would seem there are several people in this group doing the same thing - 
 would it not make sense to join forces to get a fully functional D.NET 
 compiler out the door? 
 

It would make a lot sense, maybe dmdfe would be a good start?
Nov 26 2005
prev sibling parent reply Chris <ctlajoie yahoo.com> writes:
On Sat, 26 Nov 2005 10:35:26 -0000, "John C" <johnch_atms hotmail.com>
wrote:
It would seem there are several people in this group doing the same thing - 
would it not make sense to join forces to get a fully functional D.NET 
compiler out the door? 

Who else is currently working on one? I recall one or two who said they would help if there was an open source project, but I don't remember anyone saying they were already working on one (except Deja Augustine over a year ago. his compiler wasn't open source anyway). Mine will be open source, perhaps on sourceforge (I believe dsource is for D projects only). If anyone knows where I should host it I'm open to suggestions. I prefer to use svn instead of cvs. Chris
Nov 26 2005
next sibling parent reply John Reimer <terminal.node gmail.com> writes:
Chris wrote:
 On Sat, 26 Nov 2005 10:35:26 -0000, "John C" <johnch_atms hotmail.com>
 wrote:
 
It would seem there are several people in this group doing the same thing - 
would it not make sense to join forces to get a fully functional D.NET 
compiler out the door? 

Who else is currently working on one? I recall one or two who said they would help if there was an open source project, but I don't remember anyone saying they were already working on one (except Deja Augustine over a year ago. his compiler wasn't open source anyway). Mine will be open source, perhaps on sourceforge (I believe dsource is for D projects only). If anyone knows where I should host it I'm open to suggestions. I prefer to use svn instead of cvs. Chris

Talk to Brad at dsource.org. I'm fairly certain he hosts any project that pertains to D, even if it isn't programmed in the D language itself. Example projects on dsource.org that are in other languages: eclipseD -- Java; plugin for Eclipse IDE H2D -- C++; C header to D module conversion tool DManager -- Delphi; D Project Manager And there are others. -JJR
Nov 26 2005
parent Chris <ctlajoie yahoo.com> writes:
On Sat, 26 Nov 2005 14:39:14 -0800, John Reimer
<terminal.node gmail.com> wrote:

Chris wrote:
 On Sat, 26 Nov 2005 10:35:26 -0000, "John C" <johnch_atms hotmail.com>
 wrote:
 
It would seem there are several people in this group doing the same thing - 
would it not make sense to join forces to get a fully functional D.NET 
compiler out the door? 

Who else is currently working on one? I recall one or two who said they would help if there was an open source project, but I don't remember anyone saying they were already working on one (except Deja Augustine over a year ago. his compiler wasn't open source anyway). Mine will be open source, perhaps on sourceforge (I believe dsource is for D projects only). If anyone knows where I should host it I'm open to suggestions. I prefer to use svn instead of cvs. Chris

Talk to Brad at dsource.org. I'm fairly certain he hosts any project that pertains to D, even if it isn't programmed in the D language itself. Example projects on dsource.org that are in other languages: eclipseD -- Java; plugin for Eclipse IDE H2D -- C++; C header to D module conversion tool DManager -- Delphi; D Project Manager And there are others. -JJR

I'll ask Brad then. I'd prefer to have it on dsource as long as he doesn't mind. Chris
Nov 26 2005
prev sibling next sibling parent Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
Chris wrote:
 On Sat, 26 Nov 2005 10:35:26 -0000, "John C" <johnch_atms hotmail.com>
 wrote:
 
It would seem there are several people in this group doing the same thing - 
would it not make sense to join forces to get a fully functional D.NET 
compiler out the door? 

Who else is currently working on one? I recall one or two who said they would help if there was an open source project, but I don't remember anyone saying they were already working on one (except Deja Augustine over a year ago. his compiler wasn't open source anyway).

Well I started reading Build Your Own .NET Language and Compiler and Inside Microsoft .NET IL Assembler for a purpose of playing with the idea of writing a D.NET compiler but lack free time for this. But would be more than glad to help any way I can.
 Mine will be open source, 

great
 perhaps on sourceforge (I believe dsource is
 for D projects only). 

I think it could be on dsource because it is very D-related.
 If anyone knows where I should host it I'm open
 to suggestions. I prefer to use svn instead of cvs. 

svn is IMO a better choise.
Nov 26 2005
prev sibling parent reply J C Calvarese <technocrat7 gmail.com> writes:
In article <d1mho11g54e2iv8i2fovn5rb1as7eoel6s 4ax.com>, Chris says...
On Sat, 26 Nov 2005 10:35:26 -0000, "John C" <johnch_atms hotmail.com>
wrote:
It would seem there are several people in this group doing the same thing - 
would it not make sense to join forces to get a fully functional D.NET 
compiler out the door? 

Who else is currently working on one? I recall one or two who said they would help if there was an open source project, but I don't remember anyone saying they were already working on one (except Deja Augustine over a year ago. his compiler wasn't open source anyway). Mine will be open source, perhaps on sourceforge (I believe dsource is for D projects only). If anyone knows where I should host it I'm open to suggestions. I prefer to use svn instead of cvs. Chris

I think to be eligible for dsource a project needs to be open source and either using D or related to D. It sounds like your project would be closely related to D (create a language similar to D that uses .NET, right?). It might even be based on the DMD's front-end code. By the way, the idea of a D.NET has already been discussed in a dsource topic: http://www.dsource.org/forums/viewtopic.php?t=140 (It was more a conceptual discussion than an actual request to start a project.) jcc7
Nov 26 2005
next sibling parent reply John Reimer <terminal.node gmail.com> writes:
J C Calvarese wrote:
 In article <d1mho11g54e2iv8i2fovn5rb1as7eoel6s 4ax.com>, Chris says...
 
On Sat, 26 Nov 2005 10:35:26 -0000, "John C" <johnch_atms hotmail.com>
wrote:

It would seem there are several people in this group doing the same thing - 
would it not make sense to join forces to get a fully functional D.NET 
compiler out the door? 

Who else is currently working on one? I recall one or two who said they would help if there was an open source project, but I don't remember anyone saying they were already working on one (except Deja Augustine over a year ago. his compiler wasn't open source anyway). Mine will be open source, perhaps on sourceforge (I believe dsource is for D projects only). If anyone knows where I should host it I'm open to suggestions. I prefer to use svn instead of cvs. Chris

I think to be eligible for dsource a project needs to be open source and either using D or related to D. It sounds like your project would be closely related to D (create a language similar to D that uses .NET, right?). It might even be based on the DMD's front-end code. By the way, the idea of a D.NET has already been discussed in a dsource topic: http://www.dsource.org/forums/viewtopic.php?t=140 (It was more a conceptual discussion than an actual request to start a project.) jcc7

Heh... and I was one of the ones originally against it. But things change... I'm sure D on .NET is the idea. I don't think the idea is to create a language similar to D. The language is still D. It just needs to interface with .NET. -JJR
Nov 26 2005
parent reply Chris <ctlajoie yahoo.com> writes:
On Sat, 26 Nov 2005 16:13:26 -0800, John Reimer
<terminal.node gmail.com> wrote:

 I think to be eligible for dsource a project needs to be open source and either
 using D or related to D. It sounds like your project would be closely related
to
 D (create a language similar to D that uses .NET, right?). It might even be
 based on the DMD's front-end code.
 
 By the way, the idea of a D.NET has already been discussed in a dsource topic:
 http://www.dsource.org/forums/viewtopic.php?t=140
 
 (It was more a conceptual discussion than an actual request to start a
project.)
 
 jcc7

Heh... and I was one of the ones originally against it. But things change... I'm sure D on .NET is the idea. I don't think the idea is to create a language similar to D. The language is still D. It just needs to interface with .NET. -JJR

I am not sure how we could use namespaces (.net) *and* modules (D). We could either add a namespace directive to D.NET, or we could the 'module' keyword indicate the namespace. either way, it is a deviation from the D spec. Chris
Nov 26 2005
parent J C Calvarese <technocrat7 gmail.com> writes:
In article <2i7io1p2amsbu0a0j6mpnc6j358ebmtep3 4ax.com>, Chris says...
On Sat, 26 Nov 2005 16:13:26 -0800, John Reimer
<terminal.node gmail.com> wrote:

 I think to be eligible for dsource a project needs to be open source and either
 using D or related to D. It sounds like your project would be closely related
to
 D (create a language similar to D that uses .NET, right?). It might even be
 based on the DMD's front-end code.
 
 By the way, the idea of a D.NET has already been discussed in a dsource topic:
 http://www.dsource.org/forums/viewtopic.php?t=140
 
 (It was more a conceptual discussion than an actual request to start a
project.)
 
 jcc7

Heh... and I was one of the ones originally against it. But things change... I'm sure D on .NET is the idea. I don't think the idea is to create a language similar to D. The language is still D. It just needs to interface with .NET. -JJR

I am not sure how we could use namespaces (.net) *and* modules (D). We could either add a namespace directive to D.NET, or we could the 'module' keyword indicate the namespace. either way, it is a deviation from the D spec. Chris

Might call it "D#" then. ;) jcc7
Nov 26 2005
prev sibling parent Chris <ctlajoie yahoo.com> writes:
On Sun, 27 Nov 2005 00:04:55 +0000 (UTC), J C Calvarese
<technocrat7 gmail.com> wrote:

In article <d1mho11g54e2iv8i2fovn5rb1as7eoel6s 4ax.com>, Chris says...
On Sat, 26 Nov 2005 10:35:26 -0000, "John C" <johnch_atms hotmail.com>
wrote:
It would seem there are several people in this group doing the same thing - 
would it not make sense to join forces to get a fully functional D.NET 
compiler out the door? 

Who else is currently working on one? I recall one or two who said they would help if there was an open source project, but I don't remember anyone saying they were already working on one (except Deja Augustine over a year ago. his compiler wasn't open source anyway). Mine will be open source, perhaps on sourceforge (I believe dsource is for D projects only). If anyone knows where I should host it I'm open to suggestions. I prefer to use svn instead of cvs. Chris

I think to be eligible for dsource a project needs to be open source and either using D or related to D. It sounds like your project would be closely related to D (create a language similar to D that uses .NET, right?). It might even be based on the DMD's front-end code. By the way, the idea of a D.NET has already been discussed in a dsource topic: http://www.dsource.org/forums/viewtopic.php?t=140 (It was more a conceptual discussion than an actual request to start a project.) jcc7

I decided I would not use the DMD front-end as a basis for my compiler. I would certainly use it as a reference, but my project will be entirely in managed C# so it will also run on Mono on Linux and Mac. thanks for the link. Chris
Nov 26 2005
prev sibling parent "Walter Bright" <newshound digitalmars.com> writes:
"Chris" <ctlajoie yahoo.com> wrote in message
news:h83go15mparb57e1f5d7uroprpo13seb0f 4ax.com...
 I am however very interested in compiling D (there would have to be
 some slight deviations in the syntax) directly to MSIL. In fact I'm
 reading up on compiler design and experimenting with a toy language I
 created that compiles to MSIL. Soon hopefully I will understand enough
 to begin writing one for D.

The book you want is: "Compiling for the .NET Common Language Runtime (CLR)" by John Gough
Dec 01 2005
prev sibling next sibling parent Georg Wrede <georg.wrede nospam.org> writes:
John C wrote:
 At least a couple of people were interested in using .NET from D. The 
 attached example shows one way of doing it, without hosting the CLR.
 
 Here's a taster:
 
     _ArrayList arrayList = ArrayList.createObject!(_ArrayList);
     ICollection collection = com_cast!(ICollection)(arrayList);
     int index;
     collection.add(VARIANT(12345), index);
 
     VARIANT v;
     collection.get_Item(index, v);
     writefln(v.lVal);
 
 Note that the attached files include only the bare minimum to get the
 example to run. I've not defined all the CLR types and some are
 merely placeholders. I've only tested this with .NET 2.0 (but it
 should work with 1.0/1.1).

Excellent! Just read through the zip, already now it has enormous value. I've been putting off certain Windows projects, but this is the straw that broke my procrastination! Something else I'll use this for: flaunting around with this impresses a lot of Suits and Pointy-haireds. Yet more fuel to D-evangelizing! (I know, i know, but it's like when people buy digital cameras, there just absolutely has to be the maximum pixels you can buy -- and then everybody turns the knob to 1024x768 anyway. What a joke.)
 Enjoy. 

You bet!
Nov 26 2005
prev sibling next sibling parent reply John Reimer <terminal.node gmail.com> writes:
John C wrote:
 At least a couple of people were interested in using .NET from D. The 
 attached example shows one way of doing it, without hosting the CLR.
 
 Here's a taster:
 
     _ArrayList arrayList = ArrayList.createObject!(_ArrayList);
     ICollection collection = com_cast!(ICollection)(arrayList);
     int index;
     collection.add(VARIANT(12345), index);
 
     VARIANT v;
     collection.get_Item(index, v);
     writefln(v.lVal);
 
 Note that the attached files include only the bare minimum to get the 
 example to run. I've not defined all the CLR types and some are merely 
 placeholders. I've only tested this with .NET 2.0 (but it should work with 
 1.0/1.1).
 
 Enjoy. 
 
 

I'm curious. I'm not a huge fan of .NET technology (or Microsoft in general), but I do see it's usefulness in some applications. For example, if having access to .NET allows me to program with D on mobile devices with the .NET compact framework installed, then I'm all for it. I'd love to have easy access to programming my Windows Mobile 5.0 device, especially in D. So is this an option? Will this allow me to develop on my mobile device at some point? -JJR
Nov 26 2005
parent reply "John C" <johnch_atms hotmail.com> writes:
"John Reimer" <terminal.node gmail.com> wrote in message 
news:dmaa02$2pdg$1 digitaldaemon.com...
 I'm curious. I'm not a huge fan of .NET technology (or Microsoft in 
 general), but I do see it's usefulness in some applications.  For example, 
 if having access to .NET allows me to program with D on mobile devices 
 with the .NET compact framework installed, then I'm all for it. I'd love 
 to have easy access to programming my Windows Mobile 5.0 device, 
 especially in D.

 So is this an option? Will this allow me to develop on my mobile device at 
 some point?

Only if D outputs executables that are compatible with Windows Mobile - that is, if Win32 PEs run on the Mobile platform, which if I recall they don't.
Nov 26 2005
parent reply John Reimer <terminal.node gmail.com> writes:
John C wrote:
 "John Reimer" <terminal.node gmail.com> wrote in message 
 news:dmaa02$2pdg$1 digitaldaemon.com...
 
I'm curious. I'm not a huge fan of .NET technology (or Microsoft in 
general), but I do see it's usefulness in some applications.  For example, 
if having access to .NET allows me to program with D on mobile devices 
with the .NET compact framework installed, then I'm all for it. I'd love 
to have easy access to programming my Windows Mobile 5.0 device, 
especially in D.

So is this an option? Will this allow me to develop on my mobile device at 
some point?

Only if D outputs executables that are compatible with Windows Mobile - that is, if Win32 PEs run on the Mobile platform, which if I recall they don't.

I was under the impression that if you made a D .NET compiler, it would compile to the VM and, thus, run on any .NET based device, much like Java and its VM. This isn't so? -JJR
Nov 26 2005
parent reply "John C" <johnch_atms hotmail.com> writes:
"John Reimer" <terminal.node gmail.com> wrote in message 
news:dmand7$u49$1 digitaldaemon.com...
 John C wrote:
 "John Reimer" <terminal.node gmail.com> wrote in message 
 news:dmaa02$2pdg$1 digitaldaemon.com...

I'm curious. I'm not a huge fan of .NET technology (or Microsoft in 
general), but I do see it's usefulness in some applications.  For 
example, if having access to .NET allows me to program with D on mobile 
devices with the .NET compact framework installed, then I'm all for it. 
I'd love to have easy access to programming my Windows Mobile 5.0 device, 
especially in D.

So is this an option? Will this allow me to develop on my mobile device 
at some point?

Only if D outputs executables that are compatible with Windows Mobile - that is, if Win32 PEs run on the Mobile platform, which if I recall they don't.

I was under the impression that if you made a D .NET compiler, it would compile to the VM and, thus, run on any .NET based device, much like Java and its VM. This isn't so?

Yes, I believe so, but we're talking about two different but related things on this thread, and they appear to have become somewhat muddied. One is using the .NET framework from native D. The other is (the reverse) a .NET compiler for D. Your question was in response to my example using .NET from D natively, which determined my answer.
 -JJR 

Nov 26 2005
parent John Reimer <terminal.node gmail.com> writes:
John C wrote:
 "John Reimer" <terminal.node gmail.com> wrote in message 
 news:dmand7$u49$1 digitaldaemon.com...
 
John C wrote:

"John Reimer" <terminal.node gmail.com> wrote in message 
news:dmaa02$2pdg$1 digitaldaemon.com...


I'm curious. I'm not a huge fan of .NET technology (or Microsoft in 
general), but I do see it's usefulness in some applications.  For 
example, if having access to .NET allows me to program with D on mobile 
devices with the .NET compact framework installed, then I'm all for it. 
I'd love to have easy access to programming my Windows Mobile 5.0 device, 
especially in D.

So is this an option? Will this allow me to develop on my mobile device 
at some point?

Only if D outputs executables that are compatible with Windows Mobile - that is, if Win32 PEs run on the Mobile platform, which if I recall they don't.

I was under the impression that if you made a D .NET compiler, it would compile to the VM and, thus, run on any .NET based device, much like Java and its VM. This isn't so?

Yes, I believe so, but we're talking about two different but related things on this thread, and they appear to have become somewhat muddied. One is using the .NET framework from native D. The other is (the reverse) a .NET compiler for D. Your question was in response to my example using .NET from D natively, which determined my answer.
-JJR 


Oops! My apologies. I didn't notice. -JJR
Nov 26 2005
prev sibling parent reply "Lionello Lunesu" <lio remove.lunesu.com> writes:
Great stuff! If only the syntax could be streamlined a little...

L. 
Nov 28 2005
parent "John C" <johnch_atms hotmail.com> writes:
"Lionello Lunesu" <lio remove.lunesu.com> wrote in message 
news:dmef4r$1no6$1 digitaldaemon.com...
 Great stuff! If only the syntax could be streamlined a little...

 L.

That's COM for you. In fact, as far as COM goes, that's pretty streamlined, since some functions like QueryInterface and CoCreateInstance are hidden from you in the templates. You could also write wrapper classes so that it has a D interface: class ArrayList { private: _ArrayList clrArrayList_; ICollection clrCollection_; IList clrList_; public: this() { clrArrayList_ = cirrus.c.windows.clr.ArrayList.createObject!(_ArrayList); clrCollection_ = com_cast!(ICollection)(arrayList_); clrList_ = com_cast!(IList)(arrayList_); } ~this() { clrArrayList_.Release(); clrCollection_.Release(); clrList_.Release(); } int add(VARIANT item) { int index; clrList_.Add(item, index); return index; } int indexOf(VARIANT item) { int result; clrList_.IndexOf(item, result); return result; } int count() { int result; clrCollection_.Count(result); return result; } VARIANT opIndex(int index) { VARIANT result; clrList_.get_Item(index, result); return result; } void opIndexAssign(VARIANT item, int index) { clrList_.put_Item(index, item); } int opApply(int delegate(inout VARIANT) d) { int r; for (int i = 0; i < count; i++) { VARIANT var; clrList_.get_Item(i, var); if ((r = d(var)) != 0) break; } return r; } } ArrayList list = new ArrayList; list.add(VARIANT(12345)); list.add(VARIANT(67890)); foreach (VARIANT item; list) { printf("index %d = %d\n", list.indexOf(item), item.lVal); } That's a little better, and could be improved upon further by replacing VARIANT with a some fancy Object boxing/unboxing.
Nov 28 2005