Forums

Translating stuff to Cobra

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

Re: Translating stuff to Cobra

Postby Charles » Wed Nov 03, 2010 11:07 pm

The patch has not been applied yet. You have some options:

-- Get the latest source of Cobra via Subversion and apply the patch yourself (the link is above).

-- Write a little utility class for a 2D matrix and use that.

-- Wait.
Charles
 
Posts: 2510
Location: Los Angeles, CA

Re: Translating stuff to Cobra

Postby torial » Thu Nov 04, 2010 7:02 am

Thanks, I'll decide what to do... but at the least I know I'm not as crazy as I was thinking! :?
torial
 
Posts: 227
Location: IA

Re: Translating stuff to Cobra

Postby ptokremin » Thu Jul 10, 2014 2:24 am

[removed by ptokremin - double post]
Last edited by ptokremin on Sun Jul 13, 2014 10:34 pm, edited 1 time in total.
ptokremin
 
Posts: 9
Location: Ruhrgebiet - Germany

Re: Translating stuff to Cobra

Postby ptokremin » Fri Jul 11, 2014 7:40 am

Sorry to dig this out. I know that multidimensional arrays (e.g. String[][])
may be substituted by List<of <List< of YourPreferedType > >.

But there seems to be some kind of language support for them. For instance initialisation works just fine, if you omit the type:
#  cobra.bat --version
# Cobra svn:3116 (post 0.9.6) / 2014-07-10 on .NET CLR v4.0.30319 on Microsoft Windows NT 6.1.7601 Service Pack 1
# ...
class TestArray
def main is shared
# this works fine
field0 = @[ @['Marry', 'had', 'a'], @['little','lamb, ','...'] ]
print "Damn' [ field0[0][0] ], it works! "


But declaring the type...
class TestArray
def main is shared
# this does not compile
field1 as String[] = @[ @['marry', 'had', 'a'], @['little','lamb, ','...'] ]
field2 as String[][] = @[ @['marry', 'had', 'a'], @['little','lamb, ','...'] ]
print field1[0][2], " in the context of ", field2[1][1]

... produces the compiler messages
# cobra.bat CobraTest.cobra
CobraTest.cobra(9): error: Incompatible types. Cannot assign value of type String[][] on the right to String[] on the left.
CobraTest.cobra(10): error: Invalid index expression or array type.


I understand there has been a patch which (allegedly) supports mulidimensional arrays.
What would it take to have it in the release?

kind regards
ptokremin
ptokremin
 
Posts: 9
Location: Ruhrgebiet - Germany

Re: Translating stuff to Cobra

Postby hopscc » Sat Jul 12, 2014 2:19 am

yes indeed, what would it take ?
enquiring minds want to know ....
hopscc
 
Posts: 631
Location: New Plymouth, Taranaki, New Zealand

Previous

Return to Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron