Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
Date: Sun, 12 Jun 2016 14:29:32 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] 'functions -T' tracing: recurse into anonymous functions.
Message-ID: <20160612142932.GB10072@tarsus.local2>
References: <1465580222-3300-1-git-send-email-danielsh@tarsus.local2>
 <160610210632.ZM10619@torch.brasslantern.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <160610210632.ZM10619@torch.brasslantern.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 38664

Bart Schaefer wrote on Fri, Jun 10, 2016 at 21:06:32 -0700:
> On Jun 10,  5:37pm, Daniel Shahaf wrote:
> }
> }  for this function; the flag tt(-T) does the same, but turns off tracing
> }  on any function called from the present one, unless that function also
> } -has the tt(-t) or tt(-T) flag.  The tt(-u) and tt(-U) flags cause the
> } +has the tt(-t) or tt(-T) flag or is anonymous.  The tt(-u) and tt(-U) flags cause the
> 
> That phrasing is a little hard to follow.  Perhaps something more like:
> 
> ... turns off tracing
> for any named (not anonymous) function called from the present one, unless
> that function also ...
> 
> Note I'm also suggesting changing "turns off tracing on" into "turns off
> tracing for" to reduce the chances of off/on confusion.

Good call.  Will fix before pushing.

> (Further, don't be afraid to reformat paragraphs if lines get long.)
> 

I generally avoid rewrapping paragraphs completely since default diff
tools tend to be line-based and therefore don't render such diffs
readably.

I'll break the long line into two.  (That will leave a short line, similar
to 38155.  I can rewrap the paragraph if a short line is a problem.)

> I've been considering something similar for the zsh/param/private module
> to make caller private variables visible inside anonymous functions, but
> haven't worked out all the necessary stack management.

I've also been considering something similar: I'd like PRINT_EXIT_VALUE
to recurse into anonymous functions.  IIRC the problem I ran into was
that the return value of the last command in the anon func, and of the
anon func itself, were both printed (despite being equal).

