Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: reading a file into an array. mapfile? (f)?

On Thu, Sep 18, 2008 at 11:10 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Sep 18,  6:03am, Rocky Bernstein wrote:
} I sort of agree with this comment in zshmodules:
}        It is unfortunate that the mechanism for loading modules
}        does not yet allow the user to specify the name of the shell
}        parameter to be given the special behaviour.
} Here's how it is done in Ruby which is extremely simple: if there is an
} associative array SCRIPT_LINES__ defined file lines are saved into this
} array when it reads a file.

I think you and the zsh/mapfile manual are talking about two different
things here.

Yes, you are correct. Automatically copying program text is what I mean and it's very useful, and used not just in debuggers but in other things. In ruby it's used I think in rcov (testing program coverage) for example.

What you seem to be asking for (based on what SCRIPT_LINES__ really
does in Ruby) is to have the zsh script parser stuff the lines it reads
into a variable as it parses them, so that (for example) "autoload"
would magically copy the function text into the SCRIPT_LINES__ array.

The excerpt above means that it's not possible when loading zsh/mapfile
to cause the variable "mapfile" to have a different name.  That has
nothing to do with script parsing.

Messages sorted by: Reverse Date, Date, Thread, Author