Hello, Guest the thread was viewed218 times and contains 4 replies

last post from Goodwell at the

MERGE vs IMPORT

  • Looking at these two commands, MERGE can just load code from a regular BASIC program into another one.


    IMPORT otoh, is reading BASIC text (eg no tokens) from SEQ files.
    For being able to use IMPORT on a piece of code, it needs some prep work before.


    I understand both commands and how to use them.
    But I can‘t see why someone would go through the hassle of preparations for being able to use IMPORT, when MERGE can just work on existing PRG files.


    Any enlightenment is highly appreciated, thanks :-)

  • MERGE is limited to appending the PRG on disk to the end of the PRG in memory. The line numbers of the PRG on disk must be greater than the last line number of the PRG in memory.


    IMPORT enters text into program memory as if typed. It can interleave and overwrite lines.


    I don't know which one to recommend from a workflow perspective. I suppose if I had a single library of subroutines that I want to share between programs, I would use MERGE, and give the library large line numbers. If I had multiple small libraries, I would use IMPORT so they could be imported as needed in any order—at the expense of a more obnoxious SEQ export step when editing the library code.


    I can imagine a more flexible MERGE algorithm that could merge PRGs with the interleaving effect of IMPORT. It'd involve a lot more code and more memory, similar to the relatively heavyweight RENUMBER command, which temporarily constructs a second copy of the program in bank 5 so that it can abort the procedure if it discovers an error part way through.


    (Neither IMPORT nor MERGE are currently supported in plaintext editing mode. See this feature request.)

  • MERGE is limited to appending the PRG on disk to the end of the PRG in memory. The line numbers of the PRG on disk must be greater than the last line number of the PRG in memory.

    Ah, thank you. That makes sense.

    And now that I know this, I can also find that information in the manual, just not described as explicitly

    And of course not comparing both commands directly.


    Thanks!