I have been thinking about this post that I initiated for some time. It is not the first time that I made a mistake regarding promotion; see https://chapel.discourse.group/t/intent-in-real-but-compiler-accepts-a-whole-array/28211
It is of course the programmer's (myself) responsibility to know the language features and understand what happens when inserting an array in lieu of a scalar triggers promotion. On the other hand, because promotion is much less frequently needed than standard scalar arguments, I wonder if it would make sense to make promotion an explicit request (instead of an automatic decision by the compiler), as in
proc haversine( const in x: || real) : || real {
return sin(x/2)**2 ;
}
Then the compiler would know that haversine is a candidate for promotion. Just a thought: neither a priority nor an actual feature request ...
Cheers
Nelson