That's a fair point. You'd have to require the type wrapper to make it actually effective.
On Tue, Mar 3, 2015 at 3:04 PM, Steven G. Johnson <[email protected]> wrote: > > > On Tuesday, March 3, 2015 at 2:52:06 PM UTC-5, Stefan Karpinski wrote: >> >> Then again, using type wrappers for this – bare numbers are Radians while >> an immutable Degree wrapper could wrap values in degrees – would eliminate >> a large class of common programming errors when working with angles. >> > > I'm not sure what errors you think it will prevent. It won't prevent a > programmer from passing am angle in degrees to a function expecting > radians, unless the programmer remembers to use the Degree wrapper — but in > that case why wouldn't she remember to do the conversion? > > The only way to prevent that kind of error would be to not allow bare > numbers at all in trig functions, even for radians. And the cost of that > radical a departure from existing practice is unlikely to be worth it. >
