On Fri, Oct 7, 2022 at 4:20 AM Marc Nieper-Wißkirchen <[email protected]> wrote:
(define (foo-x foo) (if (%foo? foo) (%foo-x foo) (%foo-x (%bar-foo foo)))) > To be fair, this is pretty likely to be inlined, which eliminates most of the cost, especially if the type checks can also be removed. > (instead of exporting the record name "sq" to be used in record-type > definitions of child types, the "sq" package would have to define and > export a syntax like "define-sq-type" that encapsulates everything > related to defining child types). > The object bound to the name of the record-type can contain whatever information is necessary to inherit from the record-type, surely. This appears to be how Chicken's srfi-99 egg works. However, another advantage of protocols is that the fields not directly initialized by the constructor can be computed in the constructor rather than in a separate factory procedure. See above why this would still make the SRFI 9-style syntax > considerably inferior to the R6R-style syntax. > Another possibility is that the R7RS-small syntax be extended to allow "protocol proc", where proc is the *name* of a protocol procedure rather than an arbitrary expression evaluating to a protocol procedure. >I think this is a good suggestion. Those who want implicit names (for > whatever reasons) can always use the R6RS-style form of the syntax. > And those like Daphne who "hate" implicit names get a domain where > explicit names are guaranteed. > Just so. (I don't like implicit names either, for the same reason that I don't like anaphoric `if`: names should not appear out of nowhere without having been declared.
