Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: workers/40626 (commit 6c476c22) causes multiple test failures
- X-seq: zsh-workers 40673
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: workers/40626 (commit 6c476c22) causes multiple test failures
- Date: Tue, 28 Feb 2017 21:51:10 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=iEHIJBH1IxU/2CS 4LMNMVPOysGo=; b=HfJJSdaRcf6kKaMi+EVHPs8GYmxVvJ16f+eL9gfKUWB33UP Ah7GCT8ML/YgC92g8TJLo6aqa/jS5l78vMlnNtBDsJD2w2E+alknEVlE5TRNW+ci PBHO6/FVY9fCxqO2ipeodBDgN0ABblTqladTTBr5URfBFDHdBurDGPL55790=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=iEHIJBH1IxU/2C S4LMNMVPOysGo=; b=EuiSinvBL7Iz3Ek665dJi+yDoY9MZHZfqv5fDnRxMcMT7g +ucupc/1yIgiqxcC803+tEezShr1hckybVHt0y1d5RNxbyGHYcc0vAk/V5Ox4KrJ 716AI+3FxZG/JSYxjPTxeadkD3Nge0RnBYS27QU0A2n/F0zGVfamRAfKuFR7k=
- In-reply-to: <170228110424.ZM7827@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <170225160455.ZM15040@torch.brasslantern.com> <20170226061620.GA3729@fujitsu.shahaf.local2> <170226114216.ZM4201@torch.brasslantern.com> <20170228074549.GA8753@fujitsu.shahaf.local2> <170228083855.ZM7434@torch.brasslantern.com> <20170228170329.GA9204@fujitsu.shahaf.local2> <170228110424.ZM7827@torch.brasslantern.com>
Bart Schaefer wrote on Tue, Feb 28, 2017 at 11:04:24 -0800:
> On Feb 28, 5:03pm, Daniel Shahaf wrote:
> }
> } > So here's my question ... why would you ever attempt to append to the
> } > options parameter, empty append or otherwise?
> }
> } To set multiple options at once:
> }
> } local -a options_to_set=( printexitvalue on warncreateglobal off )
> } options+=( $options_to_set )
>
> My point is you don't need append for that.
>
> options=( $options_to_set )
>
> will do exactly the same thing, because it's not possible to delete any
> of the hash keys even if you don't appear to be assigning them.
I noticed that they're equivalent, but I think it's more readable to use
+= when setting values of some options and = when setting values of all
options. That's because using = without specifying all options violates
the following invariant of hashes:
local -a a=(...)
local -A hash=( $a )
(( $#a == $#hash ))
I suppose that's an argument in favour of turning "using = without
specifying all options on the RHS" into a runtime error. :-)
Jokes aside, backwards compatibility argues that we should make neither
case an error.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author