| 04-19-2008, 01:14 AM | #1 |
I am feeling an absurd need to implement this: JASS:globals constant integer array SUMMONID=['U000','U001','U002'] endglobals later: JASS:set SUMMONID[2] = 3 //error call BJDebugMsg(I2S(SUMMONID.size()) ) // "3" call BJDebugMsg(I2S(SUMMONID[2]) ) // whatever 'U001' translates to. If anybody else would find it useful I might implement it for the next version. |
| 04-19-2008, 01:16 AM | #2 |
Uhm, yes. I was asking for this functionality ages ago in that jasshelper thread, it would be tremendously useful. |
| 04-19-2008, 01:48 AM | #3 |
Definitely yes, could we even form constant matrix's this way? |
| 04-19-2008, 02:01 AM | #4 |
I hate the syntax you've got though, I'm used to the engineering programming languages I use at work. JASS:set u = [1 2 3; 4 5 6] JASS:set u = [1 2 3] |
| 04-19-2008, 02:02 AM | #5 |
You know what would be better, multidimensional arrays! Or matrices, either works. edit: didnt see other ppl talking about matrices. |
| 04-19-2008, 02:04 AM | #6 | |
Quote:
|
| 04-19-2008, 02:05 AM | #7 | |
Quote:
I wouldn't hold my breath for multiple dimensions. |
| 04-19-2008, 02:06 AM | #8 |
alas, if I feel up to it, I may just make a matrix system... |
| 04-19-2008, 02:06 AM | #9 | ||
Quote:
Quote:
|
| 04-19-2008, 02:27 AM | #10 |
I wish, and I doubt its possible, to create a dynamic array with the size of a local... |
| 04-19-2008, 06:16 AM | #11 |
how all this will be is made? if the index of a file cannot be learned at moment of compilation is it will be simple a array, which is initialized in a stream from main ()? then what for restriction, what it would be impossible to change it? or it - is simple many constants? |
| 04-19-2008, 11:53 AM | #12 |
ADOLF i will explain what it's... Vex doing now a hero for the contest and he have a need to do that stuff. and cause he likes high lvl languages etc. he had the idea to implement it into vJass now he have created this thread to proof what he's right. + yes it's interesting preproccesor will gen global vars or 1 array ? if vars so it maybe usefull. (arrays will be in truth very limited usefull.) it's kind a "just another coding candy" |
| 04-19-2008, 12:31 PM | #13 |
It would be REALLY good that along with constant arrays there would be matrices/matrix's. The syntax for constant arrays can stay the exact same, just add an extra feature for matrices/matrix, its not that hard |
| 04-19-2008, 02:12 PM | #14 |
So, I will just thinking of stuff, and I have no reason whatsoever not to implement this: JASS:set anything = [1,2,3,a,f(3),x[4]] JASS:set anything[0]=1 set anything[1]=2 set anything[2]=3 set anything[4]=a set anything[5]=f(3) set anything[6]=x[4] Where "anything" is any object that support the []= operator (global arrays, dynamic arrays, structs with overloaded []=, struct array members, ...) Also JASS:globals integer array x=[0,1,2,5,4] endglobals becomes: JASS:globals integer array x endglobals function somethingcalledbeforeanythingelse takes nothing returns nothing set x[0]=0 set x[1]=1 set x[2]=2 set x[3]=5 set x[4]=4 endfunction Similary: JASS:globals constant integer array y=[0,1,2,5,4] endglobals Works just like array x, only that you can't change its contents in any function and y.size returns 5. Just notice that JASS:globals integer array A=[1,2,3] integer array B=[2,3,4] constant integer array C=[2,3,4] endglobals function tt takes nothing returns nothing set A=B //syntax error set A=C //works endfunction Mostly because A=B can't be compiled intelligently without converting these normal arrays into "lists" which makes everything too complicated and imho it is overkill. Eventually, I think it could be made recursive: JASS:type arr extends integer array[3] type brr extends arr array[3] function k takes nothing returns nothing local brr B=brr.create() set B[0]=arr.create() set B[1]=arr.create() set B[2]=arr.create() set B=[[0,1,2],[0,0,4],[1,2,3]] endfunction becomes: JASS:set B[0]=[0,1,2] set B[1]=[0,0,4] set B[2]=[1,2,2] which then becomes: JASS:set B[0][0]=0 set B[0][1]=1 set B[0][2]=2 set B[1][0]=0 set B[1][1]=0 set B[1][2]=4 set B[2][0]=1 set B[2][1]=2 set B[2][2]=2 And then is parsed with dynamic array stuff... Toadcop: you need to calm down else there are going to be consequences. Either way I don't really need this for hero contest or anything in particular, just checking old spells it seemed like something like this would make configuration easier. I am not sure I'll be able to make this addition before the deadline either.. |
| 04-19-2008, 04:20 PM | #15 |
That last part interests me the most, though it would be more handy if it could be called like this: JASS:set B[0,0] = 0 set B[3,2] = 2 JASS:set C[0,:] = 0 |
