What Yichao said is fundamental to Julia: there is no, none, not any, nothing the compiler does that would construct intermediate code that introduces a type mismatch. If your source does not operate on mismatched types, they will not "bubble up" in compilation.
A method determination ambiguity can occur when there is ambiguity in the resolution of a type from e.g. the conversion from another type. They go away when an explicitly disambiguating method+signature is introduced, or by erasing one that introduced the ambiguity. And this does percolate up through intermediate stages of compilation. It is not something the compiler introduces nor is it the result of the compiler making an educated guess that turns out to be wrong. Nonetheless, that kind of ambiguity is better avoided than fixed: as Avik suggests, Lint.jl is a well-used second line of defense. On Tuesday, July 12, 2016 at 7:38:07 PM UTC-4, Yichao Yu wrote: > > On Tue, Jul 12, 2016 at 7:09 PM, Zhong Pan <[email protected] <javascript:>> > wrote: > > One big problem of dynamically typed languages is type mismatch errors > only > > pop up at run time. When I say "type mismatch" I refer to the case when > the > > compiler/interpreter cannot reasonably guess a conversion, therefore > e.g. > > assigning an integer value to a double variable does not count. > > > > It'll be nice to allow quick coding leaving out type annotations for > fast > > prototyping; later on to reach production, the programmer can improve > > reliability and reduce run-time errors by annotating types as much as > > possible. > > > > Is there an option or separate tool that can perform a best-effort type > > check on the source code before it starts running? I heard that type > > mismatch may be caught by JIT compiler early if all parameters of a > function > > have been type annotated; however JIT compilation happens at run time in > > user's perspective. I think it's desirable to be able to catch problems > even > > before running anything. And the option / tool does not (and will not be > > able to) catch all type mismatch problems; but it should be able to flag > > clear violations. > > Depending on what's you definition of type error (i.e. Julia **never** > guess any conversion) `@code_warntype` should do a decent job of > catching errors. > > > > > Thanks, > > -Zhong > > >
