[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Fix record type tags to be nonglobal by module
From: |
Peter Bex |
Subject: |
[Chicken-hackers] [PATCH] Fix record type tags to be nonglobal by module-prefixing them |
Date: |
Fri, 14 Jul 2017 16:01:09 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
Hi all,
A long time ago, we had a patch that tried to prefix the current module
name onto a record type's tag (727b2b3fea271474540f215af4842d32e82e7e6d).
This was reverted later on because it turned out to be somewhat
incompatible with various things, like the record-variants egg.
I think this is quite an important change which we should try to get
in for CHICKEN 5 again, because it's a change that changes fundamentally
how record types are tagged. I believe record-variants can be fixed
if we also fix #1342 by defining the "type name" which you pass to
define-record-type as an identifier.
So (define-record foo a) defines foo?, make-foo, foo-a, foo-a-set!, but
also just foo. This is apparently a requirement of SRFI-99 and R7RS
anyway, and it should also help us to access the tag in record-variants.
The attached patch is a fairly straightforward re-application of 727b2b3,
with a slightly ore extensive test suite. It also adds the definition
of the identifier like I mentioned before.
I'd add a patch for record-variants, but I see we have no port to
CHICKEN 5 for it yet. In any case, instead of quoting the type name,
it would simply be used unquoted, as that's the identifier which holds
the tag. I don't know exactly what the problem with coops was, but I
presume it was either caused by record-variants not working or we can
fix it in a similar way by using the record identifier instead of the
quoted tag.
There are two remaining questions:
- Should the core record types like "promise", "thread" and so on be
tagged with a module prefix? I think it's fine to keep them the
way they are.
- Should the identifier be bound to the raw tag, or should it be wrapped
in some kind of opaque object (perhaps a "record type" record type)?
Personally, I think it's probably better (and also less confusing to
the user) to wrap it, but that's a slightly larger change which can
go in later, so I decided to keep this patch simple.
Cheers,
Peter
0001-Get-rid-of-global-namespace-for-record-types.patch
Description: Text Data
signature.asc
Description: PGP signature
- [Chicken-hackers] [PATCH] Fix record type tags to be nonglobal by module-prefixing them,
Peter Bex <=
- Re: [Chicken-hackers] [PATCH] Fix record type tags to be nonglobal by module-prefixing them, lemonboy, 2017/07/15
- [Chicken-hackers] [PATCH] Another symbol GC sanity check fix [was: Re: [PATCH] Fix record type tags to be nonglobal by module-prefixing them], Peter Bex, 2017/07/18
- Re: [Chicken-hackers] [PATCH] Another symbol GC sanity check fix [was: Re: [PATCH] Fix record type tags to be nonglobal by module-prefixing them], Peter Bex, 2017/07/19
- Re: [Chicken-hackers] [PATCH] Another symbol GC sanity check fix [was: Re: [PATCH] Fix record type tags to be nonglobal by module-prefixing them], felix . winkelmann, 2017/07/19
- Re: [Chicken-hackers] [PATCH] Another symbol GC sanity check fix [was: Re: [PATCH] Fix record type tags to be nonglobal by module-prefixing them], Peter Bex, 2017/07/19