Forums

cobra -correct-source ...

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

cobra -correct-source ...

Postby Charles » Sun Nov 07, 2010 2:34 pm

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.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Return to Discussion

Who is online

Users browsing this forum: No registered users and 76 guests