From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 53DC2217F9 for ; Thu, 18 Jan 2024 18:39:47 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1705599587; b=cQA4OOGPGihxeV33P2cX0D9TEmSxUCLnw7KVXmVPf+l0sHwaegCmPbAGw1NyKM7yLG1aGIwnzy f5CUUC+qCb5bKsf6S7gLErV2J2QGtyEmnhHLsDro3euHLRNdVqDNsgVxqMrDW10uu27vJjvbBs 7dCH6EJanXcTdsNplwe3oO7qmKDr+9G3U09E5Mebc4LfSXa0LtA/Qa/KmLAkI8uom23abr5uLU UHzdP6SSJ6CQIPKzrWuMqoLKeADb9kzu7VHPw4nX0uYBCCIx/SlW0fA+kse3b1uU2uDpKOnQFF yJngzNAt1XPvuRNLuez2MorxrEsoT5pCzPHi7ns536CBkA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1705599587; bh=Elzv1iz3Tz2q6SJgilo/YtkQXw9eSRTX3e6VjsTpMFA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=LntNhirM3bYzcmyz1bEu4yBlKrEc1zgEuDQvTywML1v2NMh2gpfdlDbzwZulVJKx9QbLq6DdLZ 9NwAY5tjz7G7X1A7SwCvnDLAS6LmqAhL8RiN0zA33RxSv476GRdIcEJWB3ZnjLPPrvrwmhuNrz p3uwUZzVCXoh1AjnzSYw+Xu8M+fTaRaAE/essbG8NC+kLlWsXeVgDE1c5TgaNBfUVgyvIAwuyB aK1YLb+xv6aA7bD4I1VM48lemUJT93ByHwlKEbEHivjBTLtatXhx0bdEnSj2JW0gZ3oMrno5AI gwLyPQ60ows/IozybDN/poqixzpe8QlqGuFgd6O6p7v8RQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=dBaSkWWKo7b+gX5eTtKdoUQ0r/HpsUvsv5Bu+MrcAJo=; b=p0CRiT39tyiBZNYqbO2RPPppLt WFzYjeWRy74BHTOjb2vYkhftjywBJBkzUxvqphv7LlUbtoAUJaVohUG23MPHrWdiQtYIZtbSER0zS P1u7EF7KIonaApdZDIyRQGVI+OlpcntID+uu0UAqF5HlfvoYNyMWlLkBvJYLJkb9mYnWNaLa/5emW X+xvwdzmTzQvk10uYuOfGP2AveBlYoIYUmoF+vY3yU1Ycsvu2AgsBDDlCIWSfOphjWwqFDw49DCuE jbuK5UIOHb+E9gyeHSDFoOS4osr8TjRrPD03VJnKq6UuRi5UE5SgPdVR3mEovyyvAg5Ap7ocqkS1R Ni3HosAw==; Received: by zero.zsh.org with local id 1rQWMk-000GVh-SH; Thu, 18 Jan 2024 17:39:46 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f176.google.com ([209.85.208.176]:43015) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rQWKC-000FgL-V3; Thu, 18 Jan 2024 17:37:09 +0000 Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2cdeb4b9aa4so9488911fa.0 for ; Thu, 18 Jan 2024 09:37:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705599427; x=1706204227; darn=zsh.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=dBaSkWWKo7b+gX5eTtKdoUQ0r/HpsUvsv5Bu+MrcAJo=; b=Rcqaht9bfxeyRwQbho6vPRqgPLNe3Md9HV52cddqdt5Z1siPhbnctRGLHRghROsbyQ RmgW3fOolDRLJL2FijEt/NCV/TdCDBcdSpAq+5l6f1RdITcgp3o7JiBZ5Cg1q6BCotCD v0GcsK3ST6kWQrc860GZ5i4ukIRMYPV6UmW1Mw7z52Gh2AHGVqus3oEgDsoX9wp/J8ph OslsjJJCYatrIQFr9hPAEIkBbJX6AM+kL+1O4QBRqJiXb7VL3OYEeETcGy8bvAZTmyLx B6muh+0URxzAWzzqn7EERlGZYWSjbob+kLTTzkmmHl4aCmzEGdsGHDRV7G5mchr4/o3S epkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705599427; x=1706204227; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dBaSkWWKo7b+gX5eTtKdoUQ0r/HpsUvsv5Bu+MrcAJo=; b=wCGQqINZc/iGSzJKTCFMXjVrn4Lpz2e1uqLpEad4UChIR6BwIes8FNL5/mhWfKZciG E5NIkmIJlde4L4Z/glFE8pGUSXDs4IS4ilzo7OiWldY6o6cWzV8LM9RgKKAoVq12YT9u BcyQ+dYEx8fe7G44idAU+sJ5hKnP2z4RO5eTrGYO9zpRjqJcTdBDg4IysklhaF9BCS5s 4VP/JKtHl2aFwFLN7ODRg26AQTsnW5A/g4opxc/pFpfpknxq8N2DM7mYhUSSdVQfY0Vr Js/zHV5m8+aNyCbNchjupY3xxjvBfxOutKoLGGGWNgYht4hHgyyY0oBbO4Xe1qP6tXLs OJpA== X-Gm-Message-State: AOJu0Yz4w0yBG60jbtuxsyUEXlU0N2SRYw6FSQIe03dv+r/QlA11t1YA 14XjiEJLNygQ9rpRZqH4W6L718aKxhoBD+DK231kO1IRpzjUyKBiFcA4Kvs+w2Xts8niYR0tgPy NSFqsoOsNP1q/3r8HIWJA5anc8+4OkwZjWPY= X-Google-Smtp-Source: AGHT+IExCFVOWa1xlMF+Q139cQxXgALjUfseW7XeRyv1OTI/jYYhLXlW0rNjYmYWOoVAX+NK1MNsGtbw22jQbdgXvq8= X-Received: by 2002:a2e:4949:0:b0:2cd:8dc7:6b50 with SMTP id b9-20020a2e4949000000b002cd8dc76b50mr2006157ljd.0.1705599427220; Thu, 18 Jan 2024 09:37:07 -0800 (PST) MIME-Version: 1.0 References: <205735b2-11e1-4b5e-baa2-7418753f591f@eastlink.ca> <7b20b425-59b2-466d-a9aa-a2768d1d4633@app.fastmail.com> <4b475319-ef78-4d46-a62c-27c3b0af3ea4@eastlink.ca> <49702cd2-814c-4461-9819-cc2b85bd3ea2@eastlink.ca> <0eb11a38-f94a-4289-babd-c9787787efbf@eastlink.ca> In-Reply-To: <0eb11a38-f94a-4289-babd-c9787787efbf@eastlink.ca> From: "Mark J. Reed" Date: Thu, 18 Jan 2024 12:36:54 -0500 Message-ID: Subject: Re: Empty element elision and associative arrays (was Re: Slurping a file) To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="000000000000fd17ff060f3bcf49" X-Seq: 29515 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --000000000000fd17ff060f3bcf49 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 18, 2024 at 12:22=E2=80=AFPM Ray Andrews wrote: > Seems to me to be the sort of thing that can't possibly have any gotchas. I'm not saying it would introduce gotchas. I don't think anyone's writing code that would break if assoc arrays were suddenly sorted. :) I'm saying that if zsh changed to keep its associative arrays in sorted order, and then you wrote a zsh program that *relied* on that behavior, you'd have a backward compatibility problem: your new script wouldn't work properly in older versions of zsh that didn't have the sorting. If you wanted your script to behave consistently even when run on such versions, you'd have to write manual code to keep the ordering, separately from the array itself. You could pair that with a check of $ZSH_VERSION and only do the manual bit when not running a version that does it for you automatically, but unless you're happy to cut out backward compatibility entirely, you'd still have to write it. And if you'd have to write it anyway, you might as well just use it unconditionally and avoid the complexity of switching code in and out based on the version. That's all I was saying. It wasn't much of a point, and probably didn't warrant three messages clarifying it. :) -- Mark J. Reed --000000000000fd17ff060f3bcf49 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jan 18, 2024= at 12:22=E2=80=AFPM Ray Andrews <rayandrews@eastlink.ca> wrote:
Seems to me to be the sort of thing that can't pos= sibly have any gotchas.

I'm not saying = it would introduce gotchas. I don't think anyone's writing code tha= t would break if assoc arrays were suddenly sorted. :)

=
I'm saying that if zsh changed to keep its associative arrays in s= orted order, and then you wrote a zsh program that relied on that be= havior, you'd have a backward compatibility problem: your new script wo= uldn't work properly in older versions of zsh that didn't have the = sorting. If you wanted your script to behave consistently=C2=A0even=C2=A0wh= en run on such versions, you'd have to write manual code to keep the or= dering, separately from the array itself. You could pair that with a check = of $ZSH_VERSION and only do the manual bit when not running a version that = does it for you automatically, but unless you're happy to cut out backw= ard compatibility entirely, you'd still have to write it.
And if you'd have to write it anyway, you might as well jus= t use it unconditionally and avoid the complexity of switching code in and = out based on the version.

That's all I was say= ing.=C2=A0 It wasn't much of a point, and probably didn't warrant t= hree messages clarifying it. :)

--
Mark J. Reed <markjreed@gmail.com>
--000000000000fd17ff060f3bcf49--