guile-user
[Top][All Lists]
Advanced

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

Re: end marker


From: Paul Jarc
Subject: Re: end marker
Date: Thu, 12 Feb 2004 10:59:57 -0500
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Stephen Compall <address@hidden> wrote:
> address@hidden (Paul Jarc) writes:
>> Eh, make that "guile -e function -s script.scm".  guile would still
>> read beyond (quit) (which might trigger arbitrary actions from
>> reader extensions), but Perl stops reading at __END__.
>
> How far does `read' read ahead of the last s-expression it returned?

It may buffer ahead at the stdio level, but it doesn't consume any
extra characters (so everything will be visible to the next (read)),
and it doesn't call any reader-extension procedures for the extra
characters.

> And does -s read and evaluate one s-expression at a time?

Yes, but if it's used together with -e, then that probably means that
the whole script wouldn't really do much of anything just by loading
it - it defines some procedures, and then guile calls the one
specified by -e.  However, if it uses reader extensions, then those
would typically be established at the top level, outside any procedure
definition, so they would take place during the reading of the rest of
the script.

Consider this script:
  (define (x chr port)
    (format #t "~S\n" chr)
    #t)
  (read-hash-extend #\x x)
  #x
If the (read-hash-extend) were not fully evaluated before #x is read,
you'd get an error.


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]