Does Julia syntax do enough to encourage type stability?

I think a great “plugin” to facilitate this would be something like:

function foo(bar, baz)
    # do cool stuff w/ bar and baz, but I'm worried about type-instabilities
end

@example foo(1, "hey there sailor")

In this example, the @example macro would expand to the actual function call if Atom was evaluating, and nothing otherwise. That way it could be idiomatic to include these and Atom could automatically do @code_warntype based on the example provided. This probably has the limitation of only allowing a single @example foo... per function, but it still seems like a nice way to easily set things up.

1 Like

Could it be possible to hook into the runtime via something like:

@disable_dynamic_dispatch begin
    code...
end

and if the runtime have to do a dynamic dispatch call within that block, an error with information is raised.

3 Likes

Incidentally, this has been part of the GSoC projects list since forever: http://julialang.org/soc/projects/tooling.html#performance-linting

So if anyone is interested in making this happen, that would be a great way to do it.

4 Likes