Question: Type check of parameters, take II

The issue Type check of parameters was resolved using the depends modifier. As far as I can tell, this modifier is not allowed for expected or keyword parameters, though. Thus the issue seems to reemerge for these types of parameters. Consider the following test example:

createModule := proc(V::Vector)
   local dim := LinearAlgebra:-Dimension(V);
   module()
      export f,g,h;
      f := proc( x::depends('Vector'(dim))              ) x end proc;
      g := proc( x::expects('Vector'(dim)) := something ) x end proc;
      h := proc({x::        'Vector'(dim)  := something}) x end proc;
   end module
end proc:
createModule(Vector(4)):-f(    Vector(4));
createModule(Vector(4)):-g(    Vector(4));
createModule(Vector(4)):-h(x = Vector(4));

The function f is just a restatement of the already resolved issue, compare the above link, while the functions g and h are for the expected and keyword parameter cases, respectively. The problem remains the same: the variable dim is not evaluated for g and h. What to do? Does there exist a solution equally satisfactory as the one for f?

Please Wait...