[julia-users] Re: Naming of functions advice

2015-01-13 Thread Simon Danisch
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,

[julia-users] Re: Naming of functions advice

2015-01-13 Thread Simon Danisch
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

[julia-users] Re: Naming of functions advice

2015-01-12 Thread Jason Merrill
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:

[julia-users] Re: Naming of functions advice

2015-01-12 Thread Jason Merrill
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

Re: [julia-users] Re: Naming of functions advice

2015-01-12 Thread James Crist
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

[julia-users] Re: Naming of functions advice

2015-01-12 Thread Simon Danisch
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

[julia-users] Re: Naming of functions advice

2015-01-12 Thread Ivar Nesje
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.