Apparently, promote_type doesn't return the type you get from a 
promote_rule, but the smallest type which can contain both types, which 
apparently doesn't have to be a concrete type or even something you get 
from a promote_rule! That's really confusingly named!

That means we are using promote_type in completely the wrong way elsewhere 
in Nemo. So that's already something we have to fix. But that just explains 
why the last solution didn't work, not the other problems we are having.

It certainly doesn't explain why any of the earlier solutions to my 
metaquestion don't work, including yours Jeffrey.

So, to summarise the questions so far:

1) Why does Julia define a completely generic promote_rule for any two 
types?

2) Why is  "V == s" but "s != V" in the first post of mine above?

3) Why does the function promote_rule_exists that I defined above work fine 
at the REPL but not when I place it inside the Nemo module? (Though it does 
seem to work fine when I place it in a module created in the REPL, even 
when using parameterised types and eval as we are in Nemo.)

4) What is the approved way to tell if a promote_rule exists (so that we 
can avoid getting duplicate definition warnings from the compiler)? By 
"tell if it exists", I mean tell if there is a proper promote_rule for that 
signature, not just that Julia defines a completely generic promote_rule or 
some other quasi-promote_rule exists.

Bill.

Reply via email to