My understanding (which can easily be wrong!) is that this stems from
https://github.com/JuliaLang/julia/issues/16966.
Namely that size("b") throws a method error, whereas your size(2) gives a
null tuple (). So in general broadcast (which is what the .() is sugar for)
requires that the element type object that will be vectorizing over has a
method defined for size.
In general I find Julia's behavior with strings/chars hard to understand. I
usually just use python when I need to do a lot of string processing.
On Thursday, August 18, 2016 at 7:09:19 AM UTC-7, Michael Borregaard wrote:
> I have a hard time figuring out what functions and types accept the
> broadcast dot in 0.5. E.g.,
>
> is(1, 2) # false
> is.([1, 2], 2) # Bool[false, true]
>
> is("a", "b") #false
> is.("["a","b"], "b") #MethodError: no method matching size(::String)
>
> Can anyone give me a hint?
>