On Sunday, January 12, 2014 06:39:35 PM Andy M wrote:
> 4. The documentation suggests that "type Blah; a; end" is less efficient
> than "type Blah{A}; a::A; end". If so, why does the former not default to
> the behaviour of the latter? Is it to avoid excess code generation? Or
> perhaps the latter representation has some undesirable behaviour?
"type Blah; a; end" is the same as "type Blah{Any}; a::Any; end", so just
adding a type qualifier doesn't necessarily change anything. It's only in the
case where the type specifier is concrete that it improves performance. But
sometimes you want to be able to store objects of multiple types inside a
single container (think about a vector that contains both strings and
numbers).
Andy, would you be willing to collect the responses you found helpful and add
them to the FAQ?
https://github.com/JuliaLang/julia/blob/master/doc/manual/faq.rst
You can just click "edit" on that page, no need to explicitly deal with git.
Best,
--Tim