If I understand correctly, type-asserts are well-named: they run the "bare"
code (which includes boxing the result) and then assert that the type matches
what you say it is. Their main advantage of using a type-assert is that later
code benefits from knowing the type, so type instability does not "cascade"
throughout the function.
The alternative, prospectively assigning the type, basically requires an
implementation functions with declared output types (issue #1090), but with an
additional twist: you want to be able to declare that `getindex(A, i)`, even
when `A` is an `Vector{Any}`, has return value Float64 *for that particular
`i`* (and maybe not for any other `i`). At the level of machine code, this is
quite a different function from either `getindex(::Vector{Float64}, ::Int)`
(which takes advantage of the packing in memory of Float64) or
`getindex(::Vector{Any}, ::Int)` (which uses one pointer per element, and
dereferences it to find it). So it would be an entirely new beast in julia.
Even if this gets implemented, there's still a lot of use for the current
type-assert failure; for example, if you're _wrong_ about the type of `x =
@unboxed Float64 getindex(A, i)`, that would be a bit like using @inbounds
with an index that is not, in fact, in-bounds. (I just made up that macro
syntax now, I have no idea what kind of syntax would be best for the kind of
output-type declaration you're interested in here.)
--Tim