You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in master, the list of languages supported is hardcoded. what if we dispatch on Val{:sym}? something like:
functionspelled_out(
number::Number;
lang::Symbol=Symbol(first(split(ENV["LANG"], '.'))),
dict::Symbol=:modern
)
returnspelled_out_impl(number,Val{lang},dict)
end#catchallfunctionspelled_out_impl(number,lang,dict)
throw(error("We do not support $lang yet. Please make an issue and someone might be able to help you, or feel free to contribute."))
end
and each impl. could just simply do:
function spelled_out_impl(number,lang::Type{Val{:ru}},dict)
the use of the type instead of building the val is because there is a cost on building the struct, that is elided completely when only using the type
as a nice consequence of using this, an external user could plug its own spelling function, or modify the output of existing ones
The text was updated successfully, but these errors were encountered:
in master, the list of languages supported is hardcoded. what if we dispatch on
Val{:sym}
? something like:and each impl. could just simply do:
the use of the type instead of building the val is because there is a cost on building the struct, that is elided completely when only using the type
as a nice consequence of using this, an external user could plug its own spelling function, or modify the output of existing ones
The text was updated successfully, but these errors were encountered: