From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5850 invoked from network); 15 Apr 2021 20:58:26 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Apr 2021 20:58:26 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618520306; b=zccDrqWSqtfBDXq+DwUtGA6XVdDlw5z5Rqe9xTnCfXjg0iSXewzv+Nmyl2jyCeOzfoCzgh3ABL mWEm6vIqM3xUSCkPYlUXUJB9TIZ/zaZXvyNHzdIiGuYyDFgnO7YicMm9FeY3rvk0q4PI2clEBk aU8BIyVFFHVLnGwXepP8fB+vwIADa9kVa5/c6UCDgZeKdVAL56HOCr5nH2mZGUKJBQVmcc2Scp L6TlovYKdjPvuX36m+/ReNajjlIckg4YJ/7qHrAKvhB+cB6MvuzO98l9ITsTwD8TtmzPWroU9c 8hksSkTomBdd+AFpwK/1qR06eW78ADnlMb/KfhhHJtEiQw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1618520306; bh=7F4PdQlHrlMwJmvSrqkkLXRqkLo+fiS6gknVsksuoTs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=T7yzxvErCUO6SD9ZWTUzyONBDke7V1fOfkZW0IDhXiY4Cj8v53OiAGSDuJ+H5wZ0qZNcLym958 edomD+kieZhhBmXYbGaP3qGxUdBs9PLrVDUaorVNz9QdZkrsHBPTbgk+EoxjNtY5s2IO21AXwI p5JgMCmLmNa7IUoph+C13yE9BwGSszNGf6+CQZjI64SvKDl5C8PtuIKi9OKgucdlFOgqmW17jb KWReE68WMBVl2EBP0oi/3JCkH9Hig+CBsXQ5esdi5H86HG/+R/prkUQhJ1E5itDWcGWZ+OHrxF UNBoOCX6sbLm4RQLnjuH7Jesi0Z25oBmaTYaOt6BfioDlw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ymlOzwLF3nXBVP/m5WVHJOfe0zlR+FR8ZwdHqxAwwu4=; b=LjtH9T0iPne3tuOKNb9CNWKkLu KSjLK1WTclBwhhWolUDd2khuFIrw4FNkJvasRDRF9oJvkgqqz2s1M0TYz9FbVJgze7b2yhi1juGAm CaQGdzzkbdDEJ/9vyB5z5rPENZhWlP2RpY4uNm2OsdADHr5+rhwVmoFxMjVeTBbWXkYy2GLB/7E31 FbSWcWLd7ksrmFlAHIM+hH8/IDhOIBZ1l/Vq0nHZmlOc5p9ASUHkpovZLJgbJNgW8yKM/DnJlGYsA OmTTXh2EU7vGq0cWBIE24lKqB1EtlHnVOe3GbDtImYwb2ZnZob6RTyuEfAOYZ6ZDyeoR7pQ4VUbvC LtPm/hnA==; Received: from authenticated user by zero.zsh.org with local id 1lX949-0001F8-Ob; Thu, 15 Apr 2021 20:58:21 +0000 Authentication-Results: zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out1-smtp.messagingengine.com ([66.111.4.25]:39223) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lX93x-00010K-QP; Thu, 15 Apr 2021 20:58:10 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 0C1A25C00DD; Thu, 15 Apr 2021 16:58:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 15 Apr 2021 16:58:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:subject:message-id:references :mime-version:content-type:content-transfer-encoding :in-reply-to; s=fm3; bh=ymlOzwLF3nXBVP/m5WVHJOfe0zlR+FR8ZwdHqxAw wu4=; b=uvR/FKQQjJzFa+7TWN4kXYgoXXP9zTc3IHYLeGyRIfRUZ+m+M6jm/09l q50L+X929ujh3og8Y2fASPM6FXWm7FWLxrUmDrd/yzVL8cbNP28gRvMNuGUKhtWp pGsRYX7fxliOxwL3FMteQBg8qe0Y7X/NIqnTCVlcFh8jlxnpoyxfVKNrh2Cwfi4Q 0L14u50x/iuz2HR/0hRXmjvLc7Qf6wqAvcXe78sPGCoGlE2COdpGnUvComBpexBV Y7xZeHP86um9kNeIUDXGeyDxLREqrIkPB2HmGe0eU8FcL781UdD+nfWI1G6U42bn M2EzTi1oLFcw8XIm90M8OQ29b6SpyA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=ymlOzwLF3nXBVP/m5WVHJOfe0zlR+FR8ZwdHqxAww u4=; b=PeZEZd9F8gpd4Wcf1kewkJco9A9eF+aq7DXL9/CHWr73WJtqsBFgfE1wK lbjB/t/UcNMjcd9XRQrxznRusn0/ZKkxY7HGpUQpCmcz8jhrP9x9nmXrTK6nrSQf Q27NIbyvluCyNuKjN1Pt3XbE8Q6TFbkK5sEd3O+U/+w1euBMGlOcrfzz8Cd5uyDt 7uXg/2oUWdRZZpgi6vcnruEL+hj7iIHtpBUXFBLl6ubnO6WWZxbzE4nhwf4ZDM/h U25AQwgSMXbN9bOp8HB3yZdLTZBrUARs42/5f5LwKUPBD3FYkSK8tiddu6+PQHjR D1MQzruX3NDMg9Lf6G9wEOQWWbKbg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudelfedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtugfgjggfse htkedttddtreejnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggr nhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpefgkefgfeejgf dvvdfguddtleelkedvfeetiedtudfhveevveduhfdvveeffedvueenucfkphepuddtledr ieeirdeifedrvdeftdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-109-66-63-230.red.bezeqint.net [109.66.63.230]) by mail.messagingengine.com (Postfix) with ESMTPA id 903A51080057 for ; Thu, 15 Apr 2021 16:58:08 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1005) id 4FLsB652HPz3dR; Thu, 15 Apr 2021 20:58:06 +0000 (UTC) Date: Thu, 15 Apr 2021 20:58:06 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: PM_TAGGED and PM_TAGGED_LOCAL being set simultaneously (functions -T -t f) Message-ID: <20210415205806.GD6669@tarpaulin.shahaf.local2> References: <20210414150337.GA23748@tarpaulin.shahaf.local2> <994269365.178120.1618413776846@mail2.virginmedia.com> <20210415162115.GB1002@tarpaulin.shahaf.local2> <2d162aaf0f19dfc18b6ee72d35b77d454307546c.camel@ntlworld.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2d162aaf0f19dfc18b6ee72d35b77d454307546c.camel@ntlworld.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 48594 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Peter Stephenson wrote on Thu, Apr 15, 2021 at 19:38:28 +0100: > On Thu, 2021-04-15 at 16:21 +0000, Daniel Shahaf wrote: > > > > f() g > > > > g() : > > > > functions -T f > > > > functions -t f > > > > f > > > > > > > > Should XTRACE be on or off when g is run? Or should an error be raised > > > > before g is called? > > > > > > > > And if -t were set first and -T second? > > > > > > The way the documentation is written: > > > > > > The flag -t turns on execution tracing for this function; > > > the flag -T does the same, but turns off tracing for any named (not > > > anonymous) function called from the present one, unless that func‐ > > > tion also has the -t or -T flag. > > > > > > makes it sound as if turning off for called functions is more > > > powerful behaviour, in which case -T should always be used if > > > specified. But it doesn't actually *say* that and could be > > > rewritten anyway, so it's not much of a steer. Having one flag > > > cause another to be ignored is pretty standard behaviour and > > > relatively straightforward to implement, though. > > > > So, to be clear, you're proposing that setting either flag should unset > > the other? Sounds good to me; just making sure we're on the same page. > > Actually, the suggestion was even simpler --- leave them both set, but > just allow the -T behaviour to be used if both are set. I think this is > how it's currently implemented, so it would just mean updating the > documentation. Yes, that's how it's currently implemented. > However, actually unsetting the other one is entirely rational, too. > Which is least surprising depends how you think of the options: whether you > think of the option settings as strict alternatives, or you think of > them as two separate options that happen to have an overlapping function > of which you have to pick one. So I can't really express a preference, > except to say if there's no good reason to change we should just > document what we have. Personally, I think it's actually easier to sell the "last one wins" semantics: there's no logical reason why the behaviour of «functions -Tt foo» should depend on which of -T/-t was implemented in a later version of zsh, but every reason for the behaviour to depend on whether the call passed -Tt or -tT. That would, however, be an incompatible change ☹ I figured I'd write a test to at least ensure we don't change the behaviour by accident (it would be too easy to change the if/else chain that tests the bitflags), but ran into another question along the way. Look at the first added test: diff --git a/Test/E02xtrace.ztst b/Test/E02xtrace.ztst index 10e8b8886..520b7745f 100644 --- a/Test/E02xtrace.ztst +++ b/Test/E02xtrace.ztst @@ -225,3 +225,38 @@ >the definition didn't execute it >runs + f() g + g() : + functions -t f + f +0:functions -t smoke test #1 +?+f:4> g +?+g:4> : + + f() g + g() { () : } + functions -t f + f +0:functions -t smoke test #2 +?+f:4> g +?+g:0> '(anon)' +?+(anon):0> : + + f() g + g() : + ( + functions -T f + functions -t f + f + ) + ( + functions -t f + functions -T f + f + ) +0:ensure the behaviour of 'functions -Tt f' doesn't change surreptitiously +?+f:6> g +?+f:11> g +F:If this test fails, the new behaviour may be +F:workers/48591. + PS4 at the time is at its default value, %N:%i: %i The line number currently being executed in the script, sourced file, or shell function given by %N. […] %N The name of the script, sourced file, or shell function that zsh is currently executing, whichever was started most recently. […] Given this, isn't the output «g:4» (last line of the first new test) wrong? Thanks for the answer, Peter. Cheers, Daniel