~Hakurei Shrine~ > Rika and Nitori's Garage Experiments

Json parser

Pages: << < (2/2)

Drake:

Here's a relevant post on types
Here's a typeof implementation, and a follow-up explanation of some stuff

As I mention in the above posts, concatenation has no problem combining any type of empty array with a different type of array. The particular issue you're having is because the array you're returning there isn't [], it's [[]], which is an array containing char arrays (note something like [[],"a"] is valid). You can concatenate [] ~ [[1, 2, 3]], for example.

A few more maybe-related edge cases on empty arrays I didn't cover previously:

--- Code: ---let a = [];
a = a ~ erase([1],0);    // error, because the resulting array is num-typed (type changing)
a = erase([1],0) ~ a;    // works, because the resulting array is char-typed
print(a ~ erase([1],0)); // works, because there's no type restriction here

--- End code ---


Pages: << < (2/2)

Go to full version