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.
Forums
Translating stuff to Cobra
15 posts
• Page 2 of 2 • 1, 2
Re: Translating stuff to Cobra
Thanks, I'll decide what to do... but at the least I know I'm not as crazy as I was thinking!
- torial
- Posts: 229
- Location: IA
Re: Translating stuff to Cobra
[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
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:
But declaring the type...
... produces the compiler messages
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
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
yes indeed, what would it take ?
enquiring minds want to know ....
enquiring minds want to know ....
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
15 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 4 guests