Prevent function from changing arguments (like constant pointer in C)?

This looks like an elegant solution to me, especially since this is completely opt-in. It reminds me of a feature I have wished for:

struct Foo{T} <: T end
# or
mutable struct Foo{T} <: T end

The idea is that this would create a wrapper type that behaves exactly like T, except that it is possible to define methods that specifically take a Foo{T}. It would not be allowed to add any fields, only the fields already in T would be present. This combined with getfield/setfield overriding would allow implementing your Immutable as a special case. Another application could be logging of calls to specific functions. My use case for it would be to make C++ smart pointers behave the same way as the pointed-to type.

Since this effectively introduces inheritance from a concrete type in this specific case, I’m pretty sure there are some major objections to implementing this.