Calling foo(ones(1)) returns Float64, implying that Julia has decided that a was of type Vector{T}. Is it possible to call this function explicitly specifying T as Vector{Float64}?
The author currently prescribes different behaviour based on whether or not the initPopulation parameter is the same type as an individual or is a dimension higher, and I am trying to replicate this (hence, the Union{T, Vector{T}} in my original response). It would be easy to infer what T should be if Julia Function types could be parameterised by inputs/outputs (because the objfun parameter is a function which takes a T object and returns a float), but I don’t believe this can be done. If I provided a lowerBounds or upperBounds parameter, it would be easy to infer what T should be as this parameter only accepts Vector{T}, but I don’t want to do this. Hence, I would like to explicity specify T when calling the ga function, but I cannot figure out how to do this (I am guessing it’s not possible).
Generally, if you are making a PR to a package, it is best to ask the package authors/maintainers about their preferred style.
That said, rather than go about this in the rather roundabout way you suggest, I would just make initial_population a parameter and let the caller initialize it as they please.