Re: I really hate .NET especially inside Delphi
- From: "Tim Jarvis [Borland/DTG]" <tim.jarvis@xxxxxxxxxxx>
- Date: 4 Oct 2006 06:10:43 -0700
Robert Giesecke wrote:
Tim Jarvis [Borland/DTG] wrote:
Ok, to create an assembly that looks and feels like a C# assembly,
in Delphi.NET terms this is a package (yeah, yeah, I don't know why
either, but it is what it is) a Delphi.NET package does not compile
to a BPL it will compile to a dll, in otherwords an assembly.
Hi Tim, actually I think I know what I talk about.
No offense taken and not meant to be offensive, btw. ;-)
I used D8 for some time until I simply had to give it up. Mainly
because I couldn't get the output as I wanted it to be and I simply
got used to the ease of namespaces and multi pass compiling in the
time before Delphi learned .Net. D8 didn't give me any advantage
over C# (later Chrome), only disadvantages. So why use it? ;-)
However, I checked every new release of the D.Net compiler either
using BDS205 personal or Turbo, just to see if things changed and
what was changed. But judging from threads in b.p.d.l.d.dotnet that
camtasia isn't a bad idea, anyway. :-)
Now say we creat a class in there lets call it TTestClass in the
namesapce TimsTest i.e Unit TimsTest.TTestClass, if you compile this
"package" and have a look at the created assembly with reflector you
will see a namespace called TimsTest with TTestClass in it, if you
reference this assembly in a C# project you simply would reference
this class via TimsTest.TTestClass or put a using clause in i.e.
Using TimsTest, in a Delphi app in the Uses class you would put
TimsTest.TestClass...this is some additional scoping, this is
deliberate, but not an artifact of the assembly, but Delphi, it
actually determines the unit name by reflection...if you look
closely at the assembly you will see a class attribute called
TUnitName with the scoped name passed as a parameter.
Actually, your sample is too oversimplified to show what I meant with
unit <> namespace when consuming D.Net classes from D.Net or from
another .Net language. Simply change your class "TestClass" to be
placed in a unit called "RobertsTest.Unit1".
Now I could use it like this in C#:
using RobertsTest;
...
class Blabla : TestClass
{...}
or simply this way:
class Blabla : RobertsTest.TestClass
{...}
A D.Net assembly that consumes the sample assembly with our TestClass
had to look like this
uses
RobertsTest.*Unit1*;
type
Blabla = class(TestClass)
end;
You cannot use the namespace inside a D.Net assembly:
uses
RobertsTest;
type
Blabla = class(TestClass)
end;
Using the full path instead of putting the namespace/unit name into
the uses clause does not work in D.Net, too. ;-)
So yes, its different from C#, but the assembly is perfectly valid,
and works just the same as a C# assembly...just has some additional
Delphi unit naming attributes that the Delphi IDE uses is all.
Also, don't confuse C# and VB.NET with the "usual way .NET languages
implement things" sure these are by far the most common .NET
languages, but there are some really obscure things out there that
do stuff waaay differently, have a look at some of these interesting
beasts....http://www.dotnetpowered.com/languages.aspx
Well, C#, Chrome, VB (*cough*), Nemerle, Boo, [most likely a long
list of others] do behave that way when it comes to namespaces and
how you use them. They also won't force you to provide a dcpil
besides your assembly.
ok, I am enjoying this conversation by the way, but its 11pm Here in Oz
and the thing I sat down to do I still haven't done, so if its ok with
you (and Chad and Rick) or even if its not ;-) I will continue this
tomorrow afternoon.
Cheers
--
Tim Jarvis
Product Evangelist APAC Team Lead (DTG)
.
- Follow-Ups:
- Re: I really hate .NET especially inside Delphi
- From: Rick Beerendonk
- Re: I really hate .NET especially inside Delphi
- References:
- I really hate .NET especially inside Delphi
- From: AnnShip
- Re: I really hate .NET especially inside Delphi
- From: Robert Giesecke
- Re: I really hate .NET especially inside Delphi
- From: Nick Hodges (Borland/DTG)
- Re: I really hate .NET especially inside Delphi
- From: Robert Giesecke
- Re: I really hate .NET especially inside Delphi
- From: Nick Hodges (Borland/DTG)
- Re: I really hate .NET especially inside Delphi
- From: Clinton R. Johnson
- Re: I really hate .NET especially inside Delphi
- From: Nick Hodges (Borland/DTG)
- Re: I really hate .NET especially inside Delphi
- From: Bruno Fierens [tmssoftware.com]
- Re: I really hate .NET especially inside Delphi
- From: Nick Hodges (Borland/DTG)
- Re: I really hate .NET especially inside Delphi
- From: Rick Beerendonk
- Re: I really hate .NET especially inside Delphi
- From: Robert Giesecke
- Re: I really hate .NET especially inside Delphi
- From: Tim Jarvis [Borland/DTG]
- Re: I really hate .NET especially inside Delphi
- From: Robert Giesecke
- I really hate .NET especially inside Delphi
- Prev by Date: Re: I really hate .NET especially inside Delphi
- Next by Date: Re: I really hate .NET especially inside Delphi
- Previous by thread: Re: I really hate .NET especially inside Delphi
- Next by thread: Re: I really hate .NET especially inside Delphi
- Index(es):
Relevant Pages
|