zsh-workers
 help / color / mirror / code / Atom feed
From: Rocky Bernstein <rocky.bernstein@gmail.com>
To: zsh-workers@zsh.org
Subject: Nested shell command in zshdb (Was Re: typeset -p output gives shows variables which can't be read back in)
Date: Tue, 1 Mar 2011 11:13:08 -0500	[thread overview]
Message-ID: <AANLkTi=f-zE_7vY-jpV6MK+tCTcoponi-1X3i+W+F4o+@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3528 bytes --]

On Tue, Mar 1, 2011 at 10:15 AM, Bart Schaefer <schaefer@brasslantern.com>wrote:

> On Mar 1,  1:49am, Rocky Bernstein wrote:
> }
> } Thanks for the information. The only thing I still don't understand or
> } disagree with is the "doomed from the start comment".
>
> You agree but don't know why? :-)
>

You seemed to interpret this as:
  don't (understand or disagree)
rather than the intended:
   (don't understand) or (disagree)

But to simplify it for you: I disagree.

E.g., if the shell you're debugging is six levels deep in function call
> stack at the point where you decide to break out to a new shell, the
> variables you dump are going to have several different dynamic scopes
> which it will be impossible to recreate in the new shell.



It's always the case that in any point in the program zsh is accessing
variables that were defined *somewhere* on the call chain. zsh and
programmers don't collapse under the heavy weight of this complexity :-)

Rather, you inspect and assign to variables and the values come from the
right dynamic binding according to consistent rules and get put back to the
right dynamic scope as long as you don't issue some sort of redefinition
statement.



>  It will
> have defined functions which the new shell won't have


No, I had already handled that from the start and dumped functions via
typeset -pf. (A look at the code would have shown that.)


> All true, but you can't simply assign to the name of an associative
> array variable and have it behave like an associative array.


You are greatly over-reacting here. Most zsh programs in fact don't use
associative arrays. And this is only a "problem" when you want to create
something new. The only situation that I can think of where you would want
to do this is if you had misspelled an associative array name. But if that's
the case, I suggest you use the handy debugger command called "restart"
after correcting the mistake.



> Hence "doomed" -- it's literally impossible to guarantee that you can
> store variable state


Again a gross exaggeration.  One doesn't have to be perfect *all* the time
to be helpful in *most* situations. Given two options of limiting choices to
only those things that work perfectly versus the option of allowing some
imperfection but often being helpful, guess which option I prefer?  In the
one case one is "doomed" to get nothing done. In the other case you make a
start at solving problems. Furthermore, as you go along, you realize how to
improve.

For example, I'm now considering automatic save back of changed variables as
an option, since I probably will maintain a list of those variables anyway.

I won't go into the areas where various simulations inside a debugger fail.
And those areas also extend to the bash debugger. By the way, ksh has more
control over setting scope.

But suffice it to say, in my use, I've never run into a practical case where
I have encountered any of these discrepancies which caused confusion or
prevented me from fixing a bug in using either the zsh or bash debuggers.
Furthermore, I've yet to have anyone else report that they've noticed the
long-known discrepancies. Still, I've been a been able to use both debuggers
to write significant code and solve real problems. And so have others.


> ....
> but you
> must be working in a more constrained context than I'm imagining.
>

And that's the difference -  I'm coming from this from use and experience
rather than guessing at how the debugger is used and the kinds of
problems one encounters.

             reply	other threads:[~2011-03-01 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 16:13 Rocky Bernstein [this message]
2011-03-01 16:57 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=f-zE_7vY-jpV6MK+tCTcoponi-1X3i+W+F4o+@mail.gmail.com' \
    --to=rocky.bernstein@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).