BaseXdb / basex

BaseX Main Repository.
http://basex.org
BSD 3-Clause "New" or "Revised" License
695 stars 264 forks source link

Add support for named record types #2337

Closed GuntherRademacher closed 1 month ago

GuntherRademacher commented 1 month ago

This change adds support for named record types. It augments the state of a RecordType instance by

While parsing,

As a named record type may be recursive, measures must be taken to prevent stack overflows while executing eq, instanceOf, union, and intersect. This is accomplished by keeping track of the pairs of objects that are being compared or combined when entering recursive calls, and stopping further processing when a thus known pair is detected. Unfortunatedly some SeqType methods, that used to be involved, had to be inlined in RecordType, in order to pass down the pairs.

The generation of named record type constructor functions as a StaticFunc is fairly straightforward, the actual work however is done in RecordType.RecordConstructor.