Oops. Please disregard comment on Matlab compatibility. I am almost certain Julia cannot support it in this way.
On Sunday, March 1, 2015 at 11:46:49 PM UTC-5, MA Laforge wrote: > > Good to know. The proposed method does not appear to have issues dealing > with this. Multi-dispatch can still pick up the appropriate trig() > function. See snippet I just added for angles: > > https://github.com/ma-laforge/testcases/blob/master/units_test/units_test_angles.jl > > As the code shows: Functions are easy to add once types are defined: > Base.sin(x::Radians) = sin(val(x)) > Base.sin(x::Degrees) = sind(val(x)) > Base.sin(x::Angle) = sin(Radians(x)) > > Typed angles should help maintain a compact namespace (even if we include > "Revolutions" as an angle). > > As for Stuart's comment: > Maybe Julia modules should include a Matlab compatibility submodules to > reduce clutter: > module Trigonometry #Probably excessive > ... > module MatlabCompatibility > ... > end > end > > module Algebra #Probably excessive > ... > module MatlabCompatibility > ... > end > end > > using Trigonometry > using Algebra > using MatlabCompatibility > >
