From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13101 invoked by alias); 30 Dec 2017 01:14:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42184 Received: (qmail 24734 invoked by uid 1010); 30 Dec 2017 01:14:44 -0000 X-Qmail-Scanner-Diagnostics: from mail-qt0-f181.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.216.181):SA:0(-2.6/5.0):. Processed in 1.903493 secs); 30 Dec 2017 01:14:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=CCnSyny/x/pjWl31+mMR8MyVwDIbtR+20t2Ed8DPTWY=; b=rhXIiVDx9Uj9GHF+dxfOGao7Co2hIdGC6zJRf9Lw/cxEstBvinZIx2Ty9FI2FUygQH IOdDSIVIBfDOhHBOdPDk8gFDQJPTpeBZm6TgEOf54/jzh0bCMxyRj+hoNQpLIdJFMHlb h2HuDL3oXck6cONht5GIHXM7TV4vTTU21HZ84Hn3NruNJP/N4kTGESUrxzNnYbYER5CZ LiN/MqEeHYKdDEuScOKE9dbt9CTj6KfstV6RaxHkri8sOn8g7o0dlahyOZ5lprXU8Dme GborC3F+01D0aaixg7Y6sxLsDC67FfA1fbKsrCw+UV4kNv02cYYsp25je3Iu9FY3tPpI GI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=CCnSyny/x/pjWl31+mMR8MyVwDIbtR+20t2Ed8DPTWY=; b=OTk2/9kIT1UubxZ4pqQyet3zjKqZwcl1CVt/kvb/9zmJcG48ArT0ybB+w34IYUQRNb gb0agEyo9csTNDYjlWkecMh7k2N+uoVcBdIODE6Fg8L3m663Rky1yk/nikE8eB/aXkyD A25rUZoEzJA/zcQJI/eiZVNPpnabRnpIcaqg9+oghWQJ8cYK0X4df8dLKbCGYj56BC+t 69wrOSsmTre1MKDcHNHzN4IxDiaLbhWLsqKHd1pPRwDJlSMEeHdzSN2i07s6ZJKxa+ZE YeOkFScPDGvJMWHZC8AHXQ/UKsiyO+C2lPOWKkqZPYJHrlCp+M6DR4aWHd7HDk51CKfs hBPw== X-Gm-Message-State: AKGB3mL37ZDNYAMxzpvWY9et3e53a6x0oo1c7/iuSIxo14EkK7GFV0li GAuPAo7MDGJ82cDhztuZ/svYpszUsJGW5ts5q6kmAg== X-Google-Smtp-Source: ACJfBotNFL9EKR4YRcCEJpmCesJEWu5kE2iTIVYLhgbREiUbeoYs3mw/aKaI/TN9RYjJ1HVDReUotZmeUYvtIJT70oo= X-Received: by 10.200.7.7 with SMTP id g7mr46378218qth.279.1514596479508; Fri, 29 Dec 2017 17:14:39 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Bart Schaefer Date: Fri, 29 Dec 2017 17:14:38 -0800 Message-ID: Subject: Re: How should empty aliases work? To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On Fri, Dec 29, 2017 at 12:30 AM, Bart Schaefer wrote: > > % alias empty='' > % alias output='empty echo' > % alias echo='print -r bar' > % output foo > > What actually happens is that "echo" expands and "print -r bar foo" is > executed. If that's correct, can someone explain why? I think the answer is that being a word in command position has precedence over being a word preceded by an alias replacement. Words in command position are always alias-replaceable; words not in command position are alias-replaceable if preceded by an alias replacement that ended with a space. So when "empty" disappears, it leaves "echo" in command position and the first clause applies even though the second clause does not.