write-bytevector, write & co. Lassi Kortela (16 Aug 2020 10:24 UTC)
Re: write-bytevector, write & co. Marc Nieper-Wißkirchen (16 Aug 2020 10:33 UTC)
Re: write-bytevector, write & co. Daphne Preston-Kendal (16 Aug 2020 10:37 UTC)
Re: write-bytevector, write & co. Marc Nieper-Wißkirchen (16 Aug 2020 10:44 UTC)
Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 11:04 UTC)
Re: Configuring read and write for syntax extensions Shiro Kawai (16 Aug 2020 11:46 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 11:55 UTC)
Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen (16 Aug 2020 11:59 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 12:06 UTC)
Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen (16 Aug 2020 12:25 UTC)
User-defined writers and recursive write Lassi Kortela (16 Aug 2020 12:38 UTC)
(missing)
(missing)
Re: User-defined writers and recursive write Marc Nieper-Wißkirchen (16 Aug 2020 13:32 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 12:26 UTC)
Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen (16 Aug 2020 12:33 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 12:50 UTC)
Re: Configuring read and write for syntax extensions Shiro Kawai (16 Aug 2020 12:32 UTC)
Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen (16 Aug 2020 12:35 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 12:44 UTC)
Re: Configuring read and write for syntax extensions Shiro Kawai (16 Aug 2020 12:53 UTC)
Re: Configuring read and write for syntax extensions John Cowan (17 Aug 2020 16:58 UTC)

Re: User-defined writers and recursive write Marc Nieper-Wißkirchen 16 Aug 2020 13:32 UTC

Am So., 16. Aug. 2020 um 15:20 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
>
> Accidental private reply? :)

Indeed; thanks for catching that.

For everyone else: My relevant comments are now double quoted ("> >") below.

> On 16.08.2020 16.01, Marc Nieper-Wißkirchen wrote:
> > Am So., 16. Aug. 2020 um 14:38 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
> >> That brings us to a related topic: custom implementations of `write` for
> >> user-defined data types, i.e. a Scheme procedure that is called with a
> >> port and an object of that type, and writes a representation of the
> >> object to the port. Similar to `print-object` in Common Lisp
> >> (http://www.lispworks.com/documentation/HyperSpec/Body/f_pr_obj.htm).
> >>
> >> If we let users install such procedures, those procedures can call
> >> `write` recursively. If the port settings have changed in the meantime,
> >> the new #! directives would be written in a nested part of a top-level
> >> S-expression :) That probably even makes sense, as long as proper
> >> closing of parentheses and string quotes is followed.
> >
> > It sounds as if it makes sense. The existing standardized directive
> > "#!fold-case" can appear in nested contexts and is not scoped by
> > parentheses.
> >
> >> Textual ports can also have settings that are not directly related to
> >> Scheme syntax, e.g. character encoding and whether or not to do line
> >> buffering. For maximum clarity and symmetry with the available #!
> >> directives, it could be best to keep the settings affecting Scheme
> >> syntax in a wholly separate list.
> >
> > Good point!
> >
> >> Giving arguments to #! directives will be an interesting discussion that
> >> will probably polarize opinions :) We explored it some time last year
> >> and invented `#!(precision n)` vs `#!precision n`. In any case, the `n`
> >> part has to be an S-expression. So if we represent all the enabled
> >> syntax settings as a list on the Scheme side, any S-expression can be a
> >> member of that list. Perhaps something like:
> >>
> >>   > (port-syntax (current-input-port))
> >> '(case-fold)
> >>
> >>   > (set-port-syntax! (current-input-port) '(precision 25))
> >> '(case-fold (precision 25))
> >>
> >>   > (set-port-syntax! (current-input-port) 'no-case-fold)
> >> '((precision 25))   ; no-case-fold is the default so it's not present
> >
> > If we use the "#!(precision n)" convention, we may be able to get away
> > with some of the irregularities we have discussed:
> >
> > #!fold-case would just be a shortcut (some hard-coded exception) for
> > #!(fold-case #t) and #!no-fold-case a shortcut for #!(fold-case #f).
> >
> > Similarly, #!fantastic-scheme is just some shortcut for #!(fold-case
> > #t) #!(roman-literals #t) #!(secondary-parentheses (#\[ #\])).
> >