-
Notifications
You must be signed in to change notification settings - Fork 20
Description
It is often useful in a function signature for an argument type to be an extensible record type (so additional fields are allowed, which the function can ignore, saving the need to check for their presence) while the return type is non-extensible (giving better static type checking for lookup expressions, for example).
Currently this requires two separate named record types to be declared, differing only in that one of them is extensible and the other not. This duplication is clearly undesirable.
One solution to this might be to have a single non-extensible definition of the name of the record type, with some way of indicating at the point where the record type is used that extensions are allowed.
For example (probably not viable syntax as written):
fn:element-to-map-plan(
$input as element()*
) as fn:element-to-map-conversion-plan
fn:element-to-map(
$node as element(),
$plan as extensible fn:element-to-map-conversion-plan
} as map(*)
Perhaps the syntax extensible(fn:element-to-map-conversion-plan) would work.