Consider the MWE
struct Foo
x::Any # NOT CONCRETE
end
struct Bar{Ty, Tz}
y::Ty
z::Tz # but fully parametrized here
end
f(b::Bar) = b.y + 1 # this function only uses the concrete field
b = Bar(1, Foo(9.0))
@code_warntype f(b) # I get no warnings on v0.6.2
which composes a type Foo
with an abstract field (ie violating the performance recommendation) into Bar
.
Questions:
- if I then use only the concrete fields of
Bar
, do I still get the performance benefits? (ie avoid the performance penalties?) - is there a constraint, eg the type with abstract fields being the last field?