473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Names that start with @

I'm trying to call some code written in Delphi for .Net. In Delphi,
every class has a corresponding metaclass type; you can use a
metaclass reference to create instances of the class &c. What's
important here is that some methods take a metaclass reference as a
parameter.

On .Net, metaclasses are implemented as compiler created nested
classes - something like

public class Foo
{
public class @MetaFoo
{
public static @MetaFoo @Instance;
}

public static void Bar(@MetaFoo MetaRef) {}
}

Now, VS's Object Browser can see @MetaFoo and @MetaFoo.@MetaInstance.
Intellisense even sees @MetaFoo when I type

Foo.Bar(Foo.

BUT! Intellisense does NOT see @Instance when I type
Foo.Bar(Foo.@MetaFoo.
AND when I try to compile

Foo.Bar(Foo.@MetaFoo.@Instance);

I get a message that Foo "does not contain a definition for
'MetaFoo'". I know that @Identifier is an escape to allow use of
keywords as identifiers, but how do I (can I?) tell C# that I really
truly mean @MetaFoo and @Instance, not MetaFoo and Instance?
(@@MetaFoo.@@Instance does not work.)

--

programmer, author http://www.midnightbeach.com
and father http://www.midnightbeach.com/hs
Nov 15 '05 #1
3 1327
"Jon Shemitz" <jo*@midnightbeach.com> wrote in message
news:40***************@midnightbeach.com...
I'm trying to call some code written in Delphi for .Net. In Delphi,
every class has a corresponding metaclass type; you can use a
metaclass reference to create instances of the class &c. What's
important here is that some methods take a metaclass reference as a
parameter.
BUT! Intellisense does NOT see @Instance when I type
Foo.Bar(Foo.@MetaFoo.
AND when I try to compile

Foo.Bar(Foo.@MetaFoo.@Instance);

I get a message that Foo "does not contain a definition for
'MetaFoo'". I know that @Identifier is an escape to allow use of
keywords as identifiers, but how do I (can I?) tell C# that I really
truly mean @MetaFoo and @Instance, not MetaFoo and Instance?
(@@MetaFoo.@@Instance does not work.)

Hi Jon,

I see the same thing as you, where Intellisense is not showing the verbatim
identifiers correctly. Rather it is showing the identifier without the @
symbol.

However, I ignored Intellisense and coded in the verbatim identifiers and
your code did compile for me (VS.NET 2003).

Joe
--
http://www.csharp-station.com
Nov 15 '05 #2
Joe Mayo wrote:
However, I ignored Intellisense and coded in the verbatim identifiers and
your code did compile for me (VS.NET 2003).


Thanks, Joe. Unfortunately for me, the key words in my message in
this regard were "something like". I hadn't tried compiling the
schematic code (yes, I should have) but I, too, find it compiles just
fine. So, the problem is elsewhere - not with C# and the @ escape;
perhaps with Delphi's hand-built metadata tables or somesuch. It is
strange, though, because the VS.2003 Object Browser, ILDASM, and Lutz
Roeder's Reflector can all browse the @MetaFoo type of definitions,
and can unassemble/decompile as appropriate.

--

programmer, author http://www.midnightbeach.com
and father http://www.midnightbeach.com/hs
Nov 15 '05 #3
> I see the same thing as you, where Intellisense is not showing the verbatim
identifiers correctly. Rather it is showing the identifier without the @
symbol.

However, I ignored Intellisense and coded in the verbatim identifiers and
your code did compile for me (VS.NET 2003).


Actually, if you look at the Object Browser &c, it looks like when you
declare a name like @Foo, the @ gets stripped off and what is compiled
is Foo ....

--

programmer, author http://www.midnightbeach.com
and father http://www.midnightbeach.com/hs
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Frank K. | last post by:
Hello, Hoping someone can help me out. When I select all records in a table, copy them to the clip board, and paste them to Excel the names of the fields appear in the first row in Excel....
2
by: Michael Bulatovich | last post by:
I have a simple db to keep track of work/time/projects etc. It has two fields (column) named "start time" and "end time" WITH THE SPACES. I'm trying to do some automation to a form associated with...
12
by: Eric | last post by:
I've got a pretty large C program with global variables and function names strewn about (i.e. no "static" declarations in front of them). Now I want to expose the ability for user's to supply their...
46
by: James Harris | last post by:
Before I embark on a new long-term project I'd appreciate your advice on how to split up long names. I would like to keep the standards for command names the same as that for variable names....
19
by: Roman Mashak | last post by:
Hello, All! I often meet that '_' or '__' is used as prefix to functions/macros/variables names. I wonder does it have some strict meaning? I didn't find any distinct explanation in C standard...
2
by: Dino Buljubasic | last post by:
Hi, I would like to have an array or some other kind of a variable (please suggest) that holds names of persons. When I type in a text box a letter, say 'A', the array will be searched for all...
7
by: Petr Jakes | last post by:
I have got names of functions stored in the file. For the simplicity expect one row only with two function names: printFoo, printFOO In my code I would like to define functions and then to read...
3
by: cybernerdsx2 | last post by:
Hi, I notice a function prototype being declared as following: FileStream.h ========= extern void openFile(char *__ident, int __option); But, in the function declaration part shown as...
38
by: John Salerno | last post by:
Here's my script: import sqlite3 con = sqlite3.connect('labdb') cur = con.cursor() cur.executescript(''' DROP TABLE IF EXISTS Researchers; CREATE TABLE Researchers ( researcherID...
3
by: John Machin | last post by:
I have stumbled across some class definitions which include all/most method names in a __slots__ "declaration". A cut-down and disguised example appears at the end of this posting. Never mind...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.