The Jade 2025 release focuses on modernising the developer experience and helping you build faster, smarter, and more scalable applications.
I want to create my own "addAll" for an array that deletes the array passed in, a one-shot "Add Range And Delete Child Collection" deal.
A line of code would look something like: emailArray.addRangeAndGC(someMethodThatReturnsTheSameArrayWithItems());
This method is declared on the (sub) array class:
addRangeAndGC(v_AdditionalItems : EmailArray io) updating;
Basically loop through the additional items adding to 'self', with the last line deleting said v_AdditionalItems array.
Currently this line throws a "6085" during compile.
I can work around this with a 2 line solution (assign the return value to a local variable and then call above addRangeAndGC method).
For the sake of streamlining the code it would be nice if I could do this on the one line and not have to create a "worker" variable to work around the compiler error.
I was not getting the 6085 compile error because in my example v_AdditionalItems is of type Collection, rather than the return type of someMethodThatReturnsTheSameArrayWithItems which is EmailArray. io parameters need to be of identical type.
I am not sure why your getting 6085 "Cannot assign to method" with that code.
If v_AdditionalItems is marked IO, you have to give it a variable rather than a value returned from a function because it expects to update v_AdditionalItems with its new state if its reassigned.
Changing addRangeAndGC to have v_AdditionalItems be constant like below should work for you:
Now the following jadescript will compile and work correctly:
I have attached an example schema