A Fuze update will probably need to break my code

  • I was under the impression that Fuze assigned by value, not by reference. And I have build under this assumption.

    Now I discovered by reading other people's code that this behavior is not consistent. For example in Jump a Face by Gothon, there is the following function that works:

    Function SwapEle(Arr, I, J) // Swap array elements
        var Tmp = Arr[I]
        Arr[i] = Arr[J]
        Arr[J] = Tmp
    Return VOID

    This implementation fully relies on the fact that SwapEle gets the array by reference, so that any changes made to it, will apply to all variables pointing to the same reference.

    Unfortunately with my game 2048 I initially encountered different behavior, so I've build on that. To illustrate the difference:

    function println(v) print(v, "\n") return void
    nested = [[1,2,3]]
    println(nested[0]) //[ 1, 2, 3 ]
    SwapEle(nested[0], 1, 2)
    println(nested[0])  //[ 1, 2, 3 ]
    ref = nested[0]
    nested[0][1] = 4
    println(ref)  //[ 1, 2, 3 ]
    printlin(nested[0])  //[ 1, 4, 3 ]
    ref2 = ref
    ref[2] = 5
    println(ref)  //[ 1, 2, 4 ]
    println(ref2)  //[ 1, 2, 4 ]

    I know there is awareness of this bug, but I just wanted to give the feedback that my game 2048 (at least in it's current implementation) will break when this gets fixed in an update. And I just wanted to let you know that I'm 100% fine with that, so I hope that should not be concern with any future update.

  • Small update on this: I was talking about 2048 here. .
    I think/hope my solitaire game should work with either decision on how the code should behave... At least I've build it with this uncertainty in mind.

Log in to reply