Or is that case falling under compile time for you, as the function gets
compiled for these specific arguments?
Am Montag, 12. Januar 2015 20:09:54 UTC+1 schrieb James Crist:
I'm currently writing a control theory package for Julia. The MATLAB
control theory toolbox has been around forever,
And when the call is in a function, which has the type in its arguments:
main(sys, drivingfunction) = response(sys, drivingfunction)
So it neither happens all the time (non-const globals), nor only if the
type is known at compile time, right?
Am Montag, 12. Januar 2015 20:09:54 UTC+1 schrieb
Not sure if this is very helpful, but I think `roots` would be a great name
to use instead of `zero`.
You could maybe use `stepresponse` instead of `step`, but it's a little
hard to parse with Julia's squishedcase convention.
On Monday, January 12, 2015 at 11:09:54 AM UTC-8, James Crist wrote:
Another Julian option for response functions would be to have something
like:
abstract AbstractDrivingFunction
immutable StepType : AbstractDrivingFunction
end
immutable ImpulseType : AbstractDrivingFunction
end
Step = StepType()
Impulse = ImpulseType()
Then you could have people call
Alternatively, Julia has namespaces; I'm not sure why you think it doesn't.
I know it does, but the main mode of operation seemed to be adding methods
to existing functions in Base, to allow everything to work seemlessly.
Defining `zero` to do something other than what `Base.zero` does for my
A custom type is definitely better for two reasons:
The methods you write only encapsulates one concept at a time, and not via
if end elses the concept of step and impulse in one method body.
Also, it's faster as multiple dispatch allows to call the function
directly, instead of determining
Also, it's faster as multiple dispatch allows to call the function directly,
instead of determining which code to execute via if/else.
It is only faster to use a type (and dispatch), if the type can be inferred at
compile time.