This page is part of the web mail archives of SRFI 99 from before July 7th, 2015. The new archives for SRFI 99 contain all messages, not just those from before July 7th, 2015.
I'd like to propose the addition of record printing to SRFI 99. There is no way in SRFI 99 to specify how records should be printed. Consequently, after importing a (hypothetical) queue package and writing: > (define my-queue (queue 1 7 111 10)) the result of > my-queue is some opaque default of the Scheme implementation such as #<queue:0xDEADBEEF> By allowing the implementor of the queue package to write a printer procedure and associate it with the record type, we can get the more sensible #<queue:1,7,111,10> instead. The obvious approach is to check the fourth argument of define-record-type, which currently must be a list specifying the first slot-name and its accessor and optional mutator. Under this extension, if it is an identifier, it can be interpreted as the name of the record printer procedure for this type. Note that unlike other identifiers, this is the name of a procedure to be implemented by define-record-type, but the name of a procedure implemented outside define-record-type. (This can only be done if the hygiene-breaking interpretation of a bare identifier as a slot name is dropped from SRFI 99, as proposed in my posting 1 of 3.) The resulting syntax of define-record-type becomes: (define-record-type typename (constructor args ...) predicate [printer] (field-tag accessor [mutator]) ...) In the procedural library, the record printer is an additional argument to make-rtd (before the optional magic symbols). If the argument is #f, a system-defined printer is used. (I have no objection if this argument is made optional or marked by a keyword.) The inspection library would add a rtd-printer procedure to retrieve the record printer. Printers are procedures invoked by write and display with two arguments, the record to be printed and the port to print on. -- John Cowan <cowan@xxxxxxxx> http://www.ccil.org/~cowan Today an interactive brochure website, tomorrow a global content management system that leverages collective synergy to drive "outside of the box" thinking and formulate key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. --Alex Papadimoulis