While I understand what is going on here (the string “AAAA” is being treated as an array of Char like in C), is this the expected behavior for Julia? I would’ve expected to either get an error because of incompatible types or promotion of the a1 array to Any, but I wasn’t expecting that the string would be treated as an array of chars.
It is a little surprising to me that a Char gets automatically converted to an Int here. This seems potentially dangerous in this particular case, though I haven’t thought through the broader implications of this.
Sorry for the mistake in nomenclature, but @ExpandingMan is getting at my surprise/question. Have the iterable be decomposed into Chars, and the Chars converted into Int to work with the main array seems odd (rather than having an error).
This is pretty unfortunate but I think it’s a fairly unavoidable consequence of strings being iterable sequences of characters and the fact that Char is convertible to Int. However, @jeff.bezanson is working on a change for 0.7/1.0 which will allow Int('x') to work while convert(Int, c::Char) need not be allowed, which would fix this issue.