On Monday, January 12, 2015 at 3:40:39 PM UTC-5, Kevin Squire wrote:
>
> If the functions take arguments that are typed as LTISystem, then there 
> shouldn't be any conflict. That's what multiple dispatch is for!


To expand on this, the key behavior of Julia is that it allows you to add 
new methods to existing functions.   So, if you just define

Base.zero(sys::LTISystem) = ....

it will *add* a zero() function, not replace the existing zero().  Your new 
method will be called for arguments of type LTISystem.   (Note that you 
need to either explicitly qualify the name, e.g. Base.zero, or do "import 
Base.zero", in order to tell Julia that you want to add methods to the 
existing Base function rather than replacing the function entirely.)

This is a big difference from something like Python.   e.g. when you import 
* from numpy, it overrides the built-in sum function with NumPy's.  NumPy's 
sum() implementation has to explicitly invoke the built-in sum (which it 
saves in a private _sum_ variable) in order to have access to the built-in 
sum as a fallback. 
 (See 
https://github.com/numpy/numpy/blob/d44b9c61499f8bc5a9fc94286cd52f05e15e003f/numpy/core/fromnumeric.py#L1623)

Reply via email to