Page 1 of 1

cobra -correct-source ...

PostPosted: Sun Nov 07, 2010 2:34 pm
by Charles
Suppose you have a file named MyProgram.cobra like so:
class MyProgram

def main
print 'Hello, [.name]'

get name as string
return 'world'

Cobra is case-sensitive so the line "get name as string" will give an error:

MyProgram.cobra: error: Cannot find type for "string". Try "String". Also, consider the -correct-source option (see cobra -h for details).

Leave the source in its bad state and try compiling again with the -correct-source option:

cobra -c -correct-source MyProgram.cobra

You will get no error:

Compilation succeeded

And you will find that the compiler wrote back the source code file with "String":
class MyProgram

def main
print 'Hello, [.name]'

get name as String
return 'world'

This works best when you can configure your editor to automatically reload files that have changed.

If you have any questions, let me know.