There is a lot of special purpose tricks to get good selection
in "known" cases. General rule is that interpreter prefers
"low complexity constructors" and parameterless package is
deemed low complexity, so it is used in preference to alternatives.
For DoubleFloat interpreter knows that DoubleFloat may loose exactness,
so function selection machinery adds extra penalty to "cost" of
selections involving DoubleFloat. Interpreter does not know that
there is anything special about JuliaSpecialFunctions, you exposed
it so interpreter thinks that you want it.
Also, it looks that you are plying tricks to defeat Spad typechecking.
However, in typeless context type-based overload resolution is
not going to work well: if you can coerce anything to anything,
than interpreter have no way to know what you prefer.
Anyway, for DoubleFloat 'sin' important part is that it is defined
in domain, so to use it intepreter must already have DoubleFloat
argument or must use coercion (which counts as more complex option).
So possiblities seem to be:
- follow intended design and define functions in domais
- or make sure that there is no way to automatically get
JuliaDoubleFloat from integer/integer literal
You could try adding JuliaDoubleFloat to 'isApproximate' in
src/interp/i-funsel.boot, but I doubt that it would help.
IIRC we had similar problem with special functions: we obtained
numeric values instead of symbolic ones. This was fixed adapting
current structure (or, more precisely removing deviations from
used pattern).
BTW: If you name your package JuliaDoubleFloatSpecialFunctions,
then interpreter will treat is as "associated" package to
JuliaDoubleFloat. In such case, having JuliaDoubleFloat
intepreter will consider use of functions from
JuliaDoubleFloatSpecialFunctions, but will not introduce
JuliaDoubleFloat on whim.
--
Waldek Hebisch