[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: here strings and symbols

This page is part of the web mail archives of SRFI 75 from before July 7th, 2015. The new archives for SRFI 75 contain all messages, not just those from before July 7th, 2015.

> Sebastian Egner <sebastian.egner@xxxxxxxxxxx> writes:
> > The background of the issue is the following: Sometimes I use
> > Scheme for 'rapid prototyping' in the following way---a program
> > that has no idea about Scheme, e.g. PostScript, externalizes
> > data in Scheme syntax. This data is then either read into a
> > Scheme program, or (and that is the tricky case) is directly
> > executed by a suitably primed Scheme interpreter. Now in the
> > latter case, it can be exremely convenient to reuse the identifiers
> > available in the substrate program (e.g. PostScript).
> Can you explain why it's convenient?  (I'm sure you have a rationale,
> but I'm not sure which one of the several possibilities it is.)

The program producing the output is in the substrate language,
e.g. PostScript, and it is easiest if you can print the identifier
by adding something before and after, instead of doing some string
processing (the quoting). The substrate language might not be
very good at that.

> If you want to read the resulting code yourself, it seems kind of
> awkward to have:
> (define
> |<<ARGL
> ps:foo
> (|<<ARGL
> ps:baz
> <<ARGL))
> and so on.  I'd personally rather have
> (define ps:foo (ps:baz))
> and resort to quoting or here strings only in the case of identifiers
> that defy direct translation to the "regular" identifier syntax.  Now
> both quoting and here strings involve some kind of encoding---it's not
> clear that any one is preferable, or even a translation to "regular"
> identifier syntax.

This exactly is my point: The example you gave is awkward because the
'here identifiers' you use are multi-line. With one-liners I could
print the stuff like this:

(define |+ps:foo+| (|+ps:baz+|))