I have a macro which creates these function indirections for very basic collection functions, i.e. it substitutes all Base.getindex instances with _unchecked_getindex:
Base.@propagate_inbounds @inline function _unchecked_getindex(collection, indices...)
return Base.getindex(collection, indices...)
end
Base.@propagate_inbounds @inline function _unchecked_setindex!(collection, value, indices...)
return Base.setindex!(collection, value, indices...)
end
@inline function _unchecked_in(item, collection)
return Base.in(item, collection)
end
I wonder if, with this, if everything is inferred correctly, the same code should be generated as if I used the Base functions themselves, I think it should, but I wonder if there are some footguns in doing something like this.