This relaxes every function which takes a String parameter to accept ::AbstractString instead. Importantly, all constructors with string fields are left alone, which is fine because constructors convert types to the expected type during initialization.
This PR is intended to help with things like reading games from files or from data streams where strings are not always materialized (they may be bytes and just acting like string [a la. https://github.com/JuliaStrings/StringViews.jl], views, substrings, etc). In the end, many of these will end up getting converted to strings, but it lifts the burden from the caller to ensure that everything is converted to a string before the callsite.
One concrete usecase is when reading uci strings:
julia> g = SimpleGame()
SimpleGame:
*
julia> moves = "d2d4 g8f6"
"d2d4 g8f6"
julia> for m in split(moves, " ")
domove!(g, m)
end
julia> g
SimpleGame:
1. d4 Nf6 *
However, split(moves, " ") is not a Vector{String}:
This relaxes every function which takes a
String
parameter to accept::AbstractString
instead. Importantly, all constructors with string fields are left alone, which is fine because constructors convert types to the expected type during initialization.This PR is intended to help with things like reading games from files or from data streams where strings are not always materialized (they may be bytes and just acting like string [a la. https://github.com/JuliaStrings/StringViews.jl], views, substrings, etc). In the end, many of these will end up getting converted to strings, but it lifts the burden from the caller to ensure that everything is converted to a string before the callsite.
One concrete usecase is when reading uci strings:
However,
split(moves, " ")
is not aVector{String}
:and so
domove!
fails onmaster
.