Since functions are first class objects, my answer would be "neither, just use a function": methoda = x -> one(typeof(x)) + x methodb = identity
On Sat, Aug 29, 2015 at 11:17 AM Diego Javier Zea <[email protected]> wrote: > Hi! > > I'm confused with this... > > When do I need to use Symbol instead of ASCIIString on function arguments? > > Which of the following is the best and Julian definition? > > > julia> myfunstr{T}(x::T; method::ASCIIString="one") = method=="one" ? one( > T)+x : x > myfunstr (generic function with 1 method) > > > julia> myfunsym{T}(x::T; method::Symbol=:one) = method==:one ? one(T)+x : > x > myfunsym (generic function with 1 method) > > > julia> myfunstr(10) > 11 > > > julia> myfunsym(10) > 11 > > > Thanks in advance, > Best >
