> mostly due to various technical reason

Could you please go into those? I'd like to understand why unwinding the 
stack is costlier than returning from a function.

On Saturday, May 7, 2016 at 8:38:03 AM UTC-4, Yichao Yu wrote:
>
> On Sat, May 7, 2016 at 6:58 AM, Ben Ward <axolotl...@gmail.com 
> <javascript:>> wrote: 
> > Hi, 
> > 
> > I have a question which may be laughable to CS people (be gentle, I'm a 
> > Biologist), but we know from guidelines that Julia performs best, when a 
> > method always returns the same type of value. 
> > So the Julia type inference knows - ok, use this method with an Int, it 
> will 
> > always return a bool say. How does throws fit into this? To my mind this 
> > means the method used with an Int may return a bool, but it also may 
> result 
> > in a type of (e.g.) ArgumentError getting thrown. So how do throws in 
> > functions affect performance and julian's ability to infer types and 
> > optimise code (if at all?)? 
>
> While throwing or catching an error itself is slow (mostly due to 
> various technical reason) they shouldn't affect type stability. 
>
> The type inference currently do not reason about what type of 
> exception can be thrown and even if it does, this won't affect what we 
> usually call the type stability of a function since it is only about 
> the **return type** of a function and throwing an error is not return 
> (in the sense that `a = cond ? error() : 1`, if the next statement is 
> executed, a is always a `Int`). 
>
> > 
> > Thanks, 
> > Ben W. 
>

Reply via email to