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=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID
	autolearn=ham autolearn_force=no version=3.4.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;
        h=from:message-id:date:in-reply-to:comments:references:to:subject
         :mime-version:content-type;
        bh=C8G0RyqdSHkSVJvPhQhWM9k2ZCXrFpQaB0CIfGiAKkk=;
        b=MzSpVUhFlQRKGBKGT/OGyjUJ0wq77dfOIpTp70DrsYCqU6a3z4IEP6tiph7Mfe2b4N
         rZCMcRTAZtnwBa5fvWhw8CE7uNCc5PPaG/JXbGNVKUP0owpQFAF5c9eiN/KRq4vjXJSN
         iKWosRsyaJSgIppf5q7jAqe5qtfFkk1gCx47Pmlb6H2dNzJMr6x444nyAlpKdJoH4C2m
         NLX7xwD7pMsVfjEq5dPWuSOx9OohbQR6KiuT79wkN1E/SAKWVmlPNTsYftJcE7NDzP+4
         QMTf6BrMjqa+uyqsUM9sFFhU4dyzx8jn/TiX2kmngVdq0IObQdPl7Eqd3zP4dWnvf301
         hhQg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:date:in-reply-to:comments
         :references:to:subject:mime-version:content-type;
        bh=C8G0RyqdSHkSVJvPhQhWM9k2ZCXrFpQaB0CIfGiAKkk=;
        b=bZPVG7lR2ByZvWE6tVT86eIRml9ooTlG8GFauyDeUgoBXsiZcUf786OKphriolNK3M
         ix9W40P1MEWCVIv7Y7rgmuvaDE1OBxExFHYa2eCBMqRaXhhpgbzNVGBDtTK0EaY6MUhm
         28PSzaosHD9jjdu1pfDpLEIemmAKkIIKLkByJiV0dFA9yAzxuJQDv7wlvFlEMc3fDJuI
         YZMRSaEWTG843oK0H8+J7trURgIFGqN4MVfeILYB3U0DBw6NKqChw/w41cxfBkcIm+bY
         mIN9HpDyi3H2nCtHH544+4UGS7Y9FuMl0V7dv24u/gxqf4CVaHcI28rqdJNYN5k+Ph2w
         gZPg==
X-Gm-Message-State: ALoCoQmOjZd9hgBEx9WbFMtZ7BPsD2hiNa2jEmy2Qj+UhnbK9lywQhIj0EtPS1PEme/GIClQ+N1kbL5o8+x6Dy2QrzebKLId3A==
X-Received: by 10.98.73.207 with SMTP id r76mr17995836pfi.118.1452453571488;
        Sun, 10 Jan 2016 11:19:31 -0800 (PST)
From: Bart Schaefer <schaefer@brasslantern.com>
Message-Id: <160110111943.ZM864@torch.brasslantern.com>
Date: Sun, 10 Jan 2016 11:19:43 -0800
In-Reply-To: <20160110003757.GA18461@tarsus.local2>
Comments: In reply to Daniel Shahaf <d.s@daniel.shahaf.name>
        "Aliasing assignment-ish words (aliases[x=y]=z)" (Jan  1, 12:37am)
References: <20160110003757.GA18461@tarsus.local2>
X-Mailer: OpenZMail Classic (0.9.2 24April2005)
To: zsh-workers@zsh.org
Subject: Re: Aliasing assignment-ish words (aliases[x=y]=z)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Seq: zsh-workers 37545

On Jan 1, 12:37am, Daniel Shahaf wrote:
} Subject: Aliasing assignment-ish words (aliases[x=y]=z)
}
}     2	% aliases[x=y]=z 
}     9	% x=y
} 
} Shouldn't line 9 have interpreted the word 'x=y' as an alias?

No; alias expansion operates on shell words, and in that position
on the command line "x" "=" and "y" are separate words because of
assignment syntax rules.  The new treatment of "typeset" as keyword
extends this to global aliases and "typeset x=y".

There's more to it than this because "=" and "y" are not subject to
global alias expansion when they appear in "x=y" but that's the basic
premise.

} Or perhaps line 2 should have signaled an error.

It's long-standing practice that you can create alias table entries for
things that it's not actually possible to later interpret as aliases.
This is especially true when assigning to the parameter as you did.

Basically in this case the rule is that if you break it you get to keep
the pieces.

} Also, the 'alias -L' output for that alias won't work as the code
} producing the output intended.

There is no correct output possible in this instance, the alias command
provides no way to escape the equal sign.  I don't see any reasonable
alternative except to add a csh-style alias command where the word and
its expansion can be separate arguments.

That still doesn't help with the assignment-syntax conflict.

