On Tue, Jan 27, 2004 at 02:58:20 +1100, rd(a)alphalink.com.au wrote:
an integer in
scheme? Couldnt the problem be solved by specifying
the type explicitly at send time and doing the coercion then? eg:
(-> "/foo" "isf" 100 "hello" 100.0)
That is exactly what would be required and it is not at all good. People
in user space should not have to even know that there are single and
double precision floating point representations in order to set the
frequency of an instrument. Especially not from a language
OK, I've thought about this some more and I think I agree with you now. I'l
add type coercion when I have time, should be easy enough.
In the redundant case the coercion adds one integer
comparison to the
dispatch path per argument, and thoughtful ordering of the coercion
table should get most common cases in two or three comparisons; it is
not an expensive operation.
The expense is not an issue, I've just had bad experiences with weakly
typed APIs. In this case, if we only do conversions between different
numerical types I dont see that it will hurt, as long as the corner cases
are handled sensibly.
And I am still arguing that it is an important aspect
of OSC that when a
synth advertises a '/freq' message, users can be confident that sending
it 440, whether encoded as a 32bit or 64bit integer, or as a 32bit or 64bit
float, will likely tune the synth to A440. OSC is in user space, I think it
would be a pity if synths advertised '/freqi', '/freqh', '/freqf'
and '/freqd'
Yes, this is a good point.
- Steve