Page 1 of 1

Lowerletter beginning namespace

PostPosted: Fri Feb 20, 2009 1:51 am
by arisawa
When foo.dll has a namespace beginning by a lower letter, can cobra treat it?

I was able to compile it before... :?

Re: Lowerletter beginning namespace

PostPosted: Fri Feb 20, 2009 2:08 am
by Charles
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

Re: Lowerletter beginning namespace

PostPosted: Fri Feb 20, 2009 1:12 pm
by arisawa
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.

Re: Lowerletter beginning namespace

PostPosted: Fri Feb 20, 2009 6:16 pm
by Charles
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

Re: Lowerletter beginning namespace

PostPosted: Mon Feb 23, 2009 8:13 pm
by arisawa
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

Re: Lowerletter beginning namespace

PostPosted: Mon Feb 23, 2009 10:09 pm
by Charles
I don't understand your last message. Can you provide a source file and the command line you are using?

Thanks,
Chuck

Re: Lowerletter beginning namespace

PostPosted: Mon Feb 23, 2009 10:34 pm
by Charles
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.

Re: Lowerletter beginning namespace

PostPosted: Thu Feb 26, 2009 1:45 pm
by arisawa
Yes, just I think so. :)

I was interested in "%%".
Is the variation only "%% args" ?

Re: Lowerletter beginning namespace

PostPosted: Fri Feb 27, 2009 2:00 am
by Charles
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