#35 Documentation change re: include

closed-accepted
nobody
None
5
2011-11-15
2011-11-15
Brendan Lane
No

You closed my bug report on this ("including JIT-generated file from code block - ID: 3432988") before I could comment, but it would be helpful if you changed the description of the include command in the manual. At the moment, it says that include "include[s] the contents of a file ... verbatim (as if the contents of the file were inserted at that point)", which is apparently not the case.

Thanks very much.

Discussion

  • John Bowman
    John Bowman
    2011-11-15

    It would be better to post your comments to the original bug report (still allowed even though it is deleted).

    Maybe this workaround helps?

    int x=1;
    {
    ++x;
    file fout=output("foo.asy");
    write(fout,"write(x+1);");
    close(fout);
    eval("include foo",true);
    }

     
  • John Bowman
    John Bowman
    2011-11-15

    I simply changed the documentation to read "the contents of an existing file".

     
  • John Bowman
    John Bowman
    2011-11-15

    • status: open --> closed-accepted
     
  • Brendan Lane
    Brendan Lane
    2011-11-15

    Sorry, I didn't know I could still comment on closed bugs.

    Am I right in my understanding that the include directives are all fulfilled before interpretation, not as they are reached during interpretation? And that the only way to achieve the latter behaviour is to insert the directive at interpretation time with eval?

     
  • John Bowman
    John Bowman
    2011-11-15

    Yes, that is correct.

     
  • Brendan Lane
    Brendan Lane
    2011-11-15

    Could the revised documentation make that clear? It's the only thing I can think of in Asymptote that works that way (pretty much everything else is executed when reached), and I think the exception bears noting.

    On a related note, "include" isn't in the index.