Page 2 of 2

Re: Translating stuff to Cobra

PostPosted: Wed Nov 03, 2010 11:07 pm
by Charles
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.

Re: Translating stuff to Cobra

PostPosted: Thu Nov 04, 2010 7:02 am
by torial
Thanks, I'll decide what to do... but at the least I know I'm not as crazy as I was thinking! :?

Re: Translating stuff to Cobra

PostPosted: Thu Jul 10, 2014 2:24 am
by ptokremin
[removed by ptokremin - double post]

Re: Translating stuff to Cobra

PostPosted: Fri Jul 11, 2014 7:40 am
by ptokremin
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

Re: Translating stuff to Cobra

PostPosted: Sat Jul 12, 2014 2:19 am
by hopscc
yes indeed, what would it take ?
enquiring minds want to know ....