Forums

Lowerletter beginning namespace

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Lowerletter beginning namespace

Postby arisawa » Fri Feb 20, 2009 1:51 am

When foo.dll has a namespace beginning by a lower letter, can cobra treat it?

I was able to compile it before... :?
arisawa
 
Posts: 51

Re: Lowerletter beginning namespace

Postby Charles » Fri Feb 20, 2009 2:08 am

Yes, if someone using C# or VB makes a foo.dll with a lower namespace it should work. Cobra requires the capitalization when compiling code (to distinguish namespaces and types from locals and arguments).

If you're having problems, post more details.

Thanks,
Chuck
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Lowerletter beginning namespace

Postby arisawa » Fri Feb 20, 2009 1:12 pm

Hi, Chuck
This code is transferred a sample of "wx.NET"(http://wxnet.sourceforge.net/) to a cobra.
I was able to compile it on the day(Dec 02, 2008) when I asked forum a question before.
and I can still compile it in the 0.8.0 stable.
Attachments
WxMinimal.cobra
(2.33 KiB) Downloaded 633 times
arisawa
 
Posts: 51

Re: Lowerletter beginning namespace

Postby Charles » Fri Feb 20, 2009 6:16 pm

I changed "namespace wx.Test" to "namespace WX.Test" and it gets past that problem.

The idea in Cobra is that:
-- locals and args start with lowercase, like "foo"
-- namespaces and classes start uppercase like "Foo"
-- object members start with _ like "_foo" or are accessed with a . like ".foo"

It means that when you read code like this:
e = Element(alphabet[_random.next(alphabet.length)])

You can tell that:
-- “e” and “alphabet” are local variables or arguments
-- “_random” is an object variable
-- “Element” is a type

Also, it's not likely you would want to put your own classes in the namespace of another library. You could end up with collisions/errors when upgrading the library in the future. I would call it:
namespace Arisawa.WX.Test
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Lowerletter beginning namespace

Postby arisawa » Mon Feb 23, 2009 8:13 pm

The problem was able to be settled.
however, different way was necessary. (adding "use wx")

I have another problem since I installed .NET 3.5 sp1.
cobra cannot refer to System.Drawing.dll(without appointing it) well, and at this time.
may be, my .NET is broken or not expected structure :?

Vista sp1
.NET 2.0
.NET 3.5 sp1
arisawa
 
Posts: 51

Re: Lowerletter beginning namespace

Postby Charles » Mon Feb 23, 2009 10:09 pm

I don't understand your last message. Can you provide a source file and the command line you are using?

Thanks,
Chuck
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Lowerletter beginning namespace

Postby Charles » Mon Feb 23, 2009 10:34 pm

Actually, I think I know what you're talking about now. You have to explicitly -ref:System.Drawing even though you have a "use" for it. At least, I've experienced this myself.

I caused this problem when I was fixing other problems.

The work around is to use -ref: on the command line or add this to your source file:
%% args -ref:System.Drawing

I've added ticket:152 to track this.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Lowerletter beginning namespace

Postby arisawa » Thu Feb 26, 2009 1:45 pm

Yes, just I think so. :)

I was interested in "%%".
Is the variation only "%% args" ?
arisawa
 
Posts: 51

Re: Lowerletter beginning namespace

Postby Charles » Fri Feb 27, 2009 2:00 am

I'm not sure what your question means, but I'll add more information:

You can use "%% args -ref:..." in the code. Or you can use the command line like so:
Code: Select all
cobra -ref:Foo.Bar.dll ...


Also, you can add any other arguments you want after "%% args" like:
%% args -v:3

Hope that helps,
-Chuck
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 16 guests

cron