SRFI 137's type payload can only be accessed via a procedure returned by make-type. There is no way to get a reference to such a procedure when a given a value of a certain type or when given the type predicate. So supporting the type paylod of SRFI 137 seems orthogonal to existing type systems.
- Internal type system might have used symbols or identifiers that services "type name"---e.g.for debugging or introspection. srfi-137's type payload can be any Scheme values, so eithersuch internal system adds new field in its type structure to hold the type payload, or modifyinternal system to accept any object as a type name. It's doable, but its extra complexitywithout clear benefit (except supporting srfi-137 itself).
Isn't this only a problem for portable implementations of record-type systems? If SRFI 137 finds enough support in the community, the idea would be that each implementation provides SRFI 137 and all natively supported record-type systems in the same low-level layer. Only portable implementations will have to use the SRFI 137 interface.- Records can be implemented in a way that an instance is stored in a single contiguousmemory, with type tag and instance payload together. In such systems, the constructorand accessor are likely to need copying and extra bookkeeping; or it implements srfi-137based instances with extra layer (i.e. internally srfi-137 instance is represented as anative record with a slot that holds given instance payload), which is probably the caseif srfi-137 is implemented on top of existing record systems such as srfi-9. Then we getseemingly unnecessary layering---any record system based on srfi-137 will have astructure that "a record system based on srfi-137 layer that is emulated by the nativerecord system". Probably this layering is the thing bothering me.
Existing and proposed record systems want to achieve two things at once: Providing a way to structure a vector-like value (i.e. a record), and providing a way to create disjoint types and to create subtypes for them (in the sense of SRFI 137). I have understood this SRFI as a means to untangle these two things. SRFI 137 is only about the latter.Do existing record systems so fragmented that they'll hinder further development? I mightbe unaware of that since usually I stick to a single implementation. For example, it'seasy for Gauche to provide srfi-137 on top of existing type system. But if there will benice record system srfi, I'd prefer implementing it directly bypassing srfi-137 layer.Then it doesn't matter if the initial srfi is based on srfi-9 or srfi-99 or whichever existingrecord system.
On Thu, Jun 30, 2016 at 1:28 AM, Marc Nieper-Wißkirchen <xxxxxx@gmail.com> wrote:
(It seems that I sent this to wrong address, so this is a retry)
However, existing implementations must already have internal typehandling mechanisms, and if an implementation already supports somerecord type, it's likely that it wants to directly integrate it to the internaltype system. Such internal type system doesn't need to fit smoothlywith srfi-137 protocol, in which case srfi-137 just adds complexity asopposed to simplifying it.
Can you think of a type system (that is able to handle SRFI 9 records) that is incompatible (in the sense that it doesn't fit smoothly) with SRFI 137?
Marc