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.0 (2014-02-07) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,FAKE_REPLY_C
	autolearn=ham autolearn_force=no version=3.4.0
Date: Sat, 23 Jan 2016 23:53:00 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Cc: Eric Cook <llua@gmx.com>
Subject: Re: [PATCH] typeset: set $? on incidental error
Message-ID: <20160123235300.GC20278@tarsus.local2>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20160121142201.GD21104@cventin.lip.ens-lyon.fr>
 <569FA0FC.3030004@gmx.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 37749

Between all the replies I'm convinced that the builtin interface of
'local' shouldn't be changed: «builtin local x=$(false)» should set $?
to 0.  (I meant to say that in a previous email.)

However, the question remains, in my eyes, whether the change should be
made to the reserved word interface.  The reserved word 'typeset' is not
a command, but part of the shell's language, so in
.
    typeset x=$(foo) y=$(bar)
.
the last command executed is 'bar'.  I would expect that line to behave
as similarly to
.
    x=$(foo) y=$(bar)
.
as possible, so for example, I'd expect the former to set $? to the exit
code of 'bar', as the latter statement does.

Cheers,

Daniel

