Forums

Hello World error

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

Re: Hello World error

Postby vmavra » Wed Apr 18, 2012 11:29 am

I get the same error using svn version from today on .Net 4.0 and Win7 64b. I tried the release version (Cobra 2010-10-18) first and it worked flawlessly.

Should i revert to the official version for now or keep trying?
vmavra
 
Posts: 15

Re: Hello World error

Postby Charles » Wed Apr 18, 2012 10:52 pm

vmavra wrote:I get the same error using svn version from today on .Net 4.0 and Win7 64b. I tried the release version (Cobra 2010-10-18) first and it worked flawlessly.

Should i revert to the official version for now or keep trying?

Did you run as admin?
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Hello World error

Postby vmavra » Thu Apr 19, 2012 11:13 am

Charles wrote:
vmavra wrote:I get the same error using svn version from today on .Net 4.0 and Win7 64b. I tried the release version (Cobra 2010-10-18) first and it worked flawlessly.

Should i revert to the official version for now or keep trying?

Did you run as admin?


Can't remember it but I reinstalled it anyway and got it working. Like i said I really like the syntax, but I have a few suggestions if you don't mind:

1) Remove the warning about unecessary parantheses for method calls. This improves readability imo and you should even enforce it just like in Python 3, but at least remove the warning.

2) Add optional base class init in method definition.

3) Add formatting support for print.

4) Add support for inc and dec operators.

Also can you call print without putting a nl at the end?
vmavra
 
Posts: 15

Re: Hello World error

Postby todd.a » Thu Apr 19, 2012 9:07 pm

You can get a line without a trailing break using "stop" at the end.

See http://cobra-language.com/trac/cobra/wiki/Print for other ways you can use print.
todd.a
Site Admin
 
Posts: 81
Location: Chicago, IL

Re: Hello World error

Postby vmavra » Fri Apr 20, 2012 11:26 am

todd.a wrote:You can get a line without a trailing break using "stop" at the end.

See http://cobra-language.com/trac/cobra/wiki/Print for other ways you can use print.


Yeah i found that already, thanks. :)
vmavra
 
Posts: 15

Re: Hello World error

Postby DelphiGuy » Fri Apr 20, 2012 9:03 pm

i just installed the d/l files from this website for win 7 home premium 64-bit. the install seemed routine except that i was warned that svn isn't installed on my machine. (i don't know how, and when i went to look at the various svn clients that are downloadable from the web, the nomenclature describing each one was way over my head. by the way, regarding your documentation: why would any windows computer be svn-friendly from the command line, without some type of preparation of the computer first?)

in any case, i've got the dreaded 'can't find cobra.lang' exception when trying to compile. strangely, if i copy "cobra.lang.dll" from the source folder, into the target folder, everything behaves and i can compile. i can't for the life of me see what i've done wrong in amending the path. ok, you're about to ask for the feedback from the computer, so here it is.

first, here's the install feedback:
**********************************
u If you are on Windows Vista and you get an error message then
you may need to run with elevated privileges, such as with an
admin account or power user account.

Compiling installation program...

The Cobra Programming Language
Install From Workspace

Working...

==== Verify installation directory

found dir: C:\Cobra

==== Verify running in workspace

Verified.

==== Locate and test Cobra Snapshot compiler

run: Snapshot\cobra.exe -about
: The Cobra Programming Language 0.8.0 post-release
: Copyright (C) 2003-2012 by Cobra Language LLC. All Rights Reserved.
:
: On the web: http://Cobra-Language.com/
: License: http://www.opensource.org/licenses/mit-license.php
: Source: http://cobra-language.com/source/
: Support: http://cobra-language.com/trac/cobra/wiki/UserSupport
:
: Usage: cobra -h

==== Build new Cobra compiler

run: Snapshot\cobra.exe -compile -turbo -ert:yes cobra.cobra -files:files-to-compile.text
: Compilation succeeded

==== Retrieve Cobra base version number

run: cobra.exe -version
: 0.8.0 post-release

base version: 0.8.0-post

==== Build Cobra standard library

run: cobra.exe -bsl -turbo Cobra.Lang\AssemblyAttrs.cobra -key-file:Cobra.Lang\Cobra.Lang.snk
: Compilation succeeded

==== Verify newly built Cobra compiler

run: cobra.exe -about
: The Cobra Programming Language 0.8.0 post-release
: Copyright (C) 2003-2012 by Cobra Language LLC. All Rights Reserved.
:
: On the web: http://Cobra-Language.com/
: License: http://www.opensource.org/licenses/mit-license.php
: Source: http://cobra-language.com/source/
: Support: http://cobra-language.com/trac/cobra/wiki/UserSupport
:
: Usage: cobra -h

run: cobra.exe -ert:no hello
: Hello, world.

run: cobra.exe -ert:yes hello
: Hello, world.

run: cobra.exe hello
: Hello, world.

==== Install Cobra standard library to the GAC

Invoking Publish.GacInstall...
Done.

==== Copy files to install directory

found dir: C:\Cobra
del dir : C:\Cobra\Cobra-0.8.0-post
make dir : C:\Cobra\Cobra-0.8.0-post
run: svn info
svn is not installed or it is not in the PATH. The system cannot find the file specified
** WARING: Cannot find version information, svn command line version not installed or failed.

copy from: C:\Users\Paul\Desktop\Cobra_snapshot\HowTo
to: C:\Cobra\Cobra-0.8.0-post\HowTo
copy from: C:\Users\Paul\Desktop\Cobra_snapshot\Reusables
to: C:\Cobra\Cobra-0.8.0-post\Reusables
copy from: C:\Users\Paul\Desktop\Cobra_snapshot\Samples
to: C:\Cobra\Cobra-0.8.0-post\Samples
copy from: C:\Users\Paul\Desktop\Cobra_snapshot\Supplements
to: C:\Cobra\Cobra-0.8.0-post\Supplements
make dir : C:\Cobra\Cobra-0.8.0-post\bin
copy bin: C:\Cobra\Cobra-0.8.0-post\bin
copy from: Cobra.Lang
to: C:\Cobra\Cobra-0.8.0-post\bin\Cobra.Lang
found dir: C:\Cobra\bin
writing : C:\Cobra\bin\cobra.bat

==== Verify newly installed Cobra compiler

run: C:\Cobra\bin\cobra.bat -about
: The Cobra Programming Language 0.8.0 post-release
: Copyright (C) 2003-2012 by Cobra Language LLC. All Rights Reserved.
:
: On the web: http://Cobra-Language.com/
: License: http://www.opensource.org/licenses/mit-license.php
: Source: http://cobra-language.com/source/
: Support: http://cobra-language.com/trac/cobra/wiki/UserSupport
:
: Usage: cobra -h

run: C:\Cobra\bin\cobra.bat -ert:yes hello
: Hello, world.

==== Clean up workspace

run: Snapshot\cobra.exe -compile -debug -ert:yes cobra.cobra -files:files-to-compile.text
: Compilation succeeded

run: cobra.exe -bsl -debug
: Compilation succeeded

==== Install "cobra" into a system path directory


The Cobra compiler is not in your PATH. To remedy you can:
1. Add C:\Cobra\bin to your PATH
2. Copy C:\Cobra\bin\cobra.bat to any directory in your PATH

Success!
*************************************

i assume that the "remedy" described above means: choose #1 or #2, but to be safe i did both. here's what happened in another folder that i designated for working and compiling, where i tried to compile but got the dreaded exception:

*************************************

C:\Users\Paul\Desktop\Cobra>copy c:\cobra\bin\cobra.bat
1 file(s) copied.

C:\Users\Paul\Desktop\Cobra>dir
Volume in drive C is Gateway
Volume Serial Number is 1CA0-F1C4

Directory of C:\Users\Paul\Desktop\Cobra

04/20/2012 11:51 PM <DIR> .
04/20/2012 11:51 PM <DIR> ..
04/20/2012 11:30 PM 47 cobra.bat
04/20/2012 11:34 PM 0 exception.txt
04/20/2012 08:59 PM 58 helloworld.cobra
04/20/2012 11:48 PM 3,584 helloworld.exe
04/20/2012 11:48 PM 1,022 path.txt
04/20/2012 11:08 PM 188,416 _g
6 File(s) 193,127 bytes
2 Dir(s) 250,420,490,240 bytes free

C:\Users\Paul\Desktop\Cobra>cobra helloworld

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e' or one of its depen
dencies. The system cannot find the file specified.
File name: 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e'
at Hello.Main()
at MainWrapper.Main()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


C:\Users\Paul\Desktop\Cobra>

*****************************************

but, as soon as i manually copy cobra.lang.dll from the source folder into my working/compiling folder, the compile behaves:

*****************************************

C:\Users\Paul\Desktop\Cobra>dir
Volume in drive C is Gateway
Volume Serial Number is 1CA0-F1C4

Directory of C:\Users\Paul\Desktop\Cobra

04/20/2012 11:56 PM <DIR> .
04/20/2012 11:56 PM <DIR> ..
04/20/2012 11:30 PM 47 cobra.bat
04/20/2012 11:30 PM 188,416 Cobra.Lang.dll
04/20/2012 11:34 PM 0 exception.txt
04/20/2012 08:59 PM 58 helloworld.cobra
04/20/2012 11:51 PM 3,584 helloworld.exe
04/20/2012 11:48 PM 1,022 path.txt
04/20/2012 11:08 PM 188,416 _g
7 File(s) 381,543 bytes
2 Dir(s) 250,420,002,816 bytes free

C:\Users\Paul\Desktop\Cobra>cobra helloworld
Hello, world.

C:\Users\Paul\Desktop\Cobra>

**************************************

i conclude that i'm doing something really knuckleheaded about dealing with the path, but i can't imagine what it is. i'm assuming that win is essentially a case-insensitive OS, by the way.

in case i forgot to show you the path as seen from my working folder, it's:

*************************************

PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\GtkSharp\2.12\bin;c:\users\paul\desktop\cobra_snapshot\source\
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\GtkSharp\2.12\bin;c:\cobra\bin

***************************************

-paul
DelphiGuy
 
Posts: 116

Re: Hello World error

Postby Charles » Sat Apr 21, 2012 11:51 am

vmavra wrote:...Like i said I really like the syntax, but I have a few suggestions if you don't mind:

1) Remove the warning about unecessary parantheses for method calls. This improves readability imo and you should even enforce it just like in Python 3, but at least remove the warning.

2) Add optional base class init in method definition.

3) Add formatting support for print.

4) Add support for inc and dec operators.

Also can you call print without putting a nl at the end?

1) "Remove the warning about unecessary parantheses for method calls." -- I think it's Python that does things poorly in the area of parens. What will "obj.foo" give in Python? The value of "foo" or a reference to "foo"? The answer is: it depends. If "foo" is data, you get the value. If it's a method, you get a reference. What if it's a property? You get the value.

In Cobra, you get a reference using the keyword "ref" beforehand as in "ref obj.foo" and no other way. That leaves "obj.foo" as always returning the value. You can even change the "foo" between vars, properties and parameterless methods, and the syntax to get the value is still the same.

Regarding the absence of parenthesis, this fits in with Cobra's minimal syntax. "Less is more" when it comes to syntax. Regarding the warning, Cobra favors consistent syntax between projects which makes it easier to read, inherit and maintain other people's code (at least syntactically).

I consider these to be defining characteristics of Cobra.

2) "Add optional base class init in method definition." -- I presume you mean letting the developer skip calling "base.init" or ".init" at the beginning of an initializer/constructor. Note that I gave two examples: "base.init" and ".init". I find that in C# and Java, developers don't seem to appreciate that there is an invisible call there whether they want one or not. The requirement for the explicit call is to make the developer decide what should really be done. When you have multiple initializers, say 4 of them, the correct answer is usually to chain the initializers, but in languages like C# and Java, developers almost always get this wrong and end up with 4 base/super calls instead of 1.

I realize that explanation is dense. I can expand if needed.

3) "Add formatting support for print." -- We have it. "print" has formatting which is based on the .NET formatting like so:
x = 5.3
print '[x]' # no formatting
print '[x:N3]' # formatting

4) "Add support for inc and dec operators." -- Just like Python, we use:
x += 1
y -= 1
# which can be used generally:
x += 10
y -= x

These work well and there is no confusion or question about order of execution. "x++" is shorter, but not enough to warrant adding it in my opinion and apparently Guido's.

You may agree or disagree with the above, but I at least hope these answers explain the "how" and "why" of things. Thank you for your feedback.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Hello World error

Postby vmavra » Mon Apr 23, 2012 1:25 pm

1) "Remove the warning about unecessary parantheses for method calls." -- I think it's Python that does things poorly in the area of parens. What will "obj.foo" give in Python? The value of "foo" or a reference to "foo"? The answer is: it depends. If "foo" is data, you get the value. If it's a method, you get a reference. What if it's a property? You get the value.

In Cobra, you get a reference using the keyword "ref" beforehand as in "ref obj.foo" and no other way. That leaves "obj.foo" as always returning the value. You can even change the "foo" between vars, properties and parameterless methods, and the syntax to get the value is still the same.

Regarding the absence of parenthesis, this fits in with Cobra's minimal syntax. "Less is more" when it comes to syntax. Regarding the warning, Cobra favors consistent syntax between projects which makes it easier to read, inherit and maintain other people's code (at least syntactically).

I consider these to be defining characteristics of Cobra.


Ok, then what about removing this warning only for a certain warning level?

2) "Add optional base class init in method definition." -- I presume you mean letting the developer skip calling "base.init" or ".init" at the beginning of an initializer/constructor. Note that I gave two examples: "base.init" and ".init". I find that in C# and Java, developers don't seem to appreciate that there is an invisible call there whether they want one or not. The requirement for the explicit call is to make the developer decide what should really be done. When you have multiple initializers, say 4 of them, the correct answer is usually to chain the initializers, but in languages like C# and Java, developers almost always get this wrong and end up with 4 base/super calls instead of 1.

I realize that explanation is dense. I can expand if needed.


Still, skipping it could reduce typing by quite a semnificant amount especially in big class libraries.

3) "Add formatting support for print." -- We have it. "print" has formatting which is based on the .NET formatting like so:
x = 5.3
print '[x]' # no formatting
print '[x:N3]' # formatting


That's indeed nicely done, thanks.

4) "Add support for inc and dec operators." -- Just like Python, we use:
x += 1
y -= 1
# which can be used generally:
x += 10
y -= x

These work well and there is no confusion or question about order of execution. "x++" is shorter, but not enough to warrant adding it in my opinion and apparently Guido's.


As most popular languages support this, I can't see anything wrong by adding these convenient operators, on the contrary it might actually bring more people to this very nice language as it's widely used by most programmers. Who knows, maybe you'll change your mind eventually and agree with me.

Thank you for your feedback.

You're welcome and maybe you'll see more coming in the future.
vmavra
 
Posts: 15

Re: Hello World error

Postby Charles » Mon Apr 23, 2012 5:30 pm

vmavra wrote:Ok, then what about removing this warning only for a certain warning level?

Sorry, but Cobra favors uniform syntax between projects. While it can be disappointing when the syntax doesn't match one's personal prefs, it is great for sharing code, inheriting projects and collaboration.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Hello World error

Postby Charles » Tue Apr 24, 2012 7:41 pm

DelphiGuy wrote:i just installed the d/l files from this website for win 7 home premium 64-bit. the install seemed routine except that i was warned that svn isn't installed on my machine. (i don't know how, and when i went to look at the various svn clients that are downloadable from the web, the nomenclature describing each one was way over my head. by the way, regarding your documentation: why would any windows computer be svn-friendly from the command line, without some type of preparation of the computer first?)
...
i conclude that i'm doing something really knuckleheaded about dealing with the path, but i can't imagine what it is. i'm assuming that win is essentially a case-insensitive OS, by the way.
...

Sorry I couldn't respond to this right away.

I doubt that you're doing anything wrong. I'm guessing it has something to do with different .NET versions and the GAC (Global Assembly Cache) where assemblies like Cobra.Lang.dll are stored. For example, if you are installing the last release from 2010, the installer will be installing Cobra for .NET 2.0/3.0/3.5 (all the same virtual machine), but may be using a "gacutil.exe" utility that is putting the Cobra.Lang.dll in the .NET 4.0 GAC.

IIRC the most recent installer doesn't even use "svn" any more, but reads the revision number right out a file.

I will try out the latest source on Win7 64b and see what happens.
Charles
 
Posts: 2515
Location: Los Angeles, CA

PreviousNext

Return to Discussion

Who is online

Users browsing this forum: No registered users and 15 guests

cron