Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#3 Loading a file aborts the top-level s-exp

closed
nobody
None
5
2006-12-07
2006-11-03
Tom Breton
No

When a file is loaded, and the load command is not
top-level, execution seems to skip the remainder
of the the s-exp. By "not top-level", I mean the
load statement is nested in something like
"begin".

Tinyscheme version is 1.37

The output when tsbug1.scm is loaded from the
command line is:

[Begin output]
In tsbug1.scm, before loading tsbug3
[End output]

Invoked interactively via load, same behavior:

[Begin]
> (load "tsbug1.scm")
Loading tsbug1.scm
In tsbug1.scm, before loading tsbug3
[End]

Invoked completely interactively, the behavior
gets even odder. It is as if execution did not
return to top level, or had inconsistent ideas
about whether it was at top level.

My input to this example was only to cut-and-paste
the "begin" statement from tsbug1.scm, followed by
a carriage return. I did this slowly so there was
no question of the interpreter not being ready for
input. As you can see from the last few lines, it
would not immediately even acknowledge "quit".

[Begin]
> (begin
(load "tsbug3.scm")
(display "In tsbug1.scm, after loading tsbug3")
(newline)
(display "Still in the begin")
(newline))
Loading tsbug3.scm
> (begin
(load "tsbug3.scm")
(display "In tsbug1.scm, after loading tsbug3")
(newline)
(display "Still in the begin")
(newline))Loading tsbug3.scm
>
#t
> Still in the begin#t
> (begin
(load "tsbug3.scm")
(display "In tsbug1.scm, after loading tsbug3")
(newline)
(display "Still in the begin")
(newline))
#t
> Error: syntax error: illegal token

> (quit)
Loading tsbug3.scm
> (quit)
[End]

The same behavior seems to occur when "and" is
substituted for "begin".

Note: I suspect this may be related to bug 1589701
because they both occur immediately after loading.

Note: tsbug3.scm is just a blank file.

Discussion

  • Tom Breton
    Tom Breton
    2006-11-03

    File demonstrating the bug

     
    Attachments
  • Tom Breton
    Tom Breton
    2006-11-10

    Logged In: YES
    user_id=62720

    On further inspection, some of the behavior of the third
    florid example is due to bug 1589701 and occurs only if
    tsbug3.scm ends in a comment.

    With a truly blank tsbug3.scm, the interactive cut-and-paste
    behavior is the same as the non-interactive behavior, rather
    than the florid
    confusion quoted earlier.

     
  • Tom Breton
    Tom Breton
    2006-11-10

    Blank file

     
    Attachments
  • Kevin Cozens
    Kevin Cozens
    2006-11-30

    Logged In: YES
    user_id=1113465
    Originator: NO

    I can't reproduce the problem using the attached scripts.

     
  • Tom Breton
    Tom Breton
    2006-12-01

    Logged In: YES
    user_id=62720
    Originator: YES

    As with the other bug, after a fresh unzip and make, the problem remains.

    As mentioned in a followup, please note that the florid output in original report, I later discovered, was partly due to bug 1589701 because the "blank" file I was using ended in a comment. That is, it ends before the newline that would terminate a comment. The attached files now demonstrate bug 1589711 alone.

    Without participation from bug 1589701, the output is less crazy but still skips everything inside "begin" after the "load" statement.

    [Begin]
    In tsbug1.scm, before loading tsbug3
    In tsbug1.scm, after exiting begin
    [End]

     
  • Kevin Cozens
    Kevin Cozens
    2006-12-04

    Logged In: YES
    user_id=1113465
    Originator: NO

    Having fixed bug 1589701, this is indeed the same bug. The way to reproduce it is to create tsbug3.scm using the following command:
    echo -n ";Comment line" > tsbug3.scm

     
    • status: open --> closed