Page 1 of 2

Cobra fails to Run Hello World

PostPosted: Fri Feb 06, 2009 6:19 pm
by gtoast
I copied the Helloworld example and cannot get Cobra to run.

power-mac-g4:~/Programming/cobra/helloworld gtoast$ cobra -v hello.cobra
Cobra Command Line 0.8.0
Copyright (C) 2003-2008 by Cobra Language LLC.

OS Version: Unix 8.11.0.0
CLR Platform: Mono
CLR Version: 2.0.50727.1433
Current Directory: /Users/damany/Programming/cobra/helloworld
Current Exe: /usr/local/cobra/cobra-0.8.0/bin/cobra.exe
Option Dictionary:
verbosity: 1
contracts: 'inline'
debugging-tips: true
embed-run-time: true
include-asserts: true
include-tests: true
number: 'decimal'
Paths:
hello.cobra
Reading assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 at /Library/Frameworks/Mono.framework/Versions/2.2/lib/mono/2.0/mscorlib.dll
Reading assembly: System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 at /Library/Frameworks/Mono.framework/Versions/2.2/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll
Noting /usr/local/cobra/cobra-0.8.0/bin/CobraInfo.cs
Parsing /usr/local/cobra/cobra-0.8.0/bin/SystemInterfaces.cobra
Parsing /usr/local/cobra/cobra-0.8.0/bin/CobraLang.cobra
Noting /usr/local/cobra/cobra-0.8.0/bin/CobraLang.cs
Parsing hello.cobra
/usr/local/cobra/cobra-0.8.0/bin/CobraLang.cobra(1416): error: Cannot redeclare "item" as "Object?" because it was declared as "T" earlier.
/usr/local/cobra/cobra-0.8.0/bin/CobraLang.cobra(1427): error: Argument 1 of method "add" expects a non-nilable type (T), but the call is supplying a nilable type (Object?).
Compilation failed - 2 errors, 0 warnings
Not running due to errors above.


Anyone have any insight?

Thanks.

Re: Cobra fails to Run Hello World

PostPosted: Fri Feb 06, 2009 8:21 pm
by jonathandavid
I think you're using an old version of Cobra. Mine says (notice the "2009"):

Cobra Command Line 0.8.0
Copyright (C) 2003-2009 by Cobra Language LLC.

Your problem will probably disappear if you download the latest version.

Hope it helps

Re: Cobra fails to Run Hello World

PostPosted: Fri Feb 06, 2009 9:21 pm
by Charles
Please install Cobra according to HowToInstallFromSource

Mine says:
Code: Select all
>cobra

The Cobra Programming Language 0.8.0 post-release
Copyright (C) 2003-2009 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


Note the "post-release" in the title.

Re: Cobra fails to Run Hello World

PostPosted: Mon Feb 09, 2009 10:44 am
by gtoast
d'oh. Attempting to install from source fails as well:
power-mac-g4:~/Programming/cobra gtoast$ svn co http://cobra-language.com/svn/cobra/trunk/ cobra-workspace
...
power-mac-g4:~/Programming/cobra gtoast$ cd cobra-workspace/Source/
power-mac-g4:~/Programming/cobra/cobra-workspace/Source gtoast$ sudo ./install-from-workspace
Password:

You may need to run via sudo or as root in order to
install to system directories like /usr/local/cobra

Compiling installation program...
/Users/gtoast/Programming/cobra/cobra-workspace/Source/Snapshot/Cobra.Lang/Set.cobra(197): error: Cannot redeclare "item" as "Object?" because it was declared as "T" earlier.
Compilation failed - 1 error, 0 warnings
Not running due to errors above.


Looks like it failing to build for the same reason helloworld is failing to run.

Re: Cobra fails to Run Hello World

PostPosted: Mon Feb 09, 2009 11:02 am
by Charles
Sorry to hear that. It works fine on my system with the latest code and Mono 2.0. What output do you get for "mono --version"?
Code: Select all
$  mono --version
Mono JIT compiler version 2.0 (tarball)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
        TLS:           normal
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  x86
        Disabled:      none

Re: Cobra fails to Run Hello World

PostPosted: Mon Feb 09, 2009 11:08 am
by gtoast
Looks like i have the newer version of the compiler. Is that breaking it?
$ mono --version
Mono JIT compiler version 2.2 (tarball Fri Jan 9 11:00:24 MST 2009)
Copyright (C) 2002-2008 Novell, Inc and Contributors. http://www.mono-project.com
TLS: normal
GC: Included Boehm (with typed GC)
SIGSEGV: normal
Notification: Thread + polling
Architecture: ppc
Disabled: none



Or a bug in the ppc mono compiler? Cobra runs fine on my macbookpro at running 10.5.

Re: Cobra fails to Run Hello World

PostPosted: Mon Feb 09, 2009 7:35 pm
by Charles
I'll give Mono 2.2 a try and let you know.

Re: Cobra fails to Run Hello World

PostPosted: Mon Feb 09, 2009 8:14 pm
by Charles
Yep, everything breaks. Will investigate.

Re: Cobra fails to Run Hello World

PostPosted: Mon Feb 09, 2009 11:32 pm
by Charles
There are 2 problems. One is a new bug in Mono 2.2 which I have reported here:

False compilation error for some string literals
https://bugzilla.novell.com/show_bug.cgi?id=474194

The other is that System.Reflection in Mono 2.2 returns interfaces for IList<of T> in a different order than earlier versions and Cobra is sensitive to the order. I will make Cobra insensitive to the order.

In the mean time, please use Mono 2.0.

-Chuck

Re: Cobra fails to Run Hello World

PostPosted: Mon Feb 09, 2009 11:54 pm
by gtoast
Will do. Thanks for the speedy responses!