Type constraints not enforced

create type T like String { constraint C value = "V" };

create operator O(AT : T) : String
result := AT;

select O(T("Not V"));

I know that type constraints aren't checked at selector invocation, only at variable assignment. But this operator invocation will happily return "Not V" instead of raising an error, implying that within the operator body, we have a variable of type T that doesn't fulfill the T type constraint. Bug, no?


Hi Jon,

Apologies for the delayed response.

Yes, this is a defect. The system should be preventing the value from being passed as an argument because conceptually, argument passing is an assignment of the value of the argument to the variable representing the argument within the body of the operator. I will add this to the list of defects and try to get it resolved soon.

Bryn Rhodes
Database Consulting Group LLC