From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3992 invoked from network); 8 Jul 2020 17:00:30 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 8 Jul 2020 17:00:30 -0000 Received: (qmail 26070 invoked by alias); 8 Jul 2020 17:00:18 -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: Sender: zsh-workers@zsh.org X-Seq: 46218 Received: (qmail 2733 invoked by uid 1010); 8 Jul 2020 17:00:18 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f43.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25863. spamassassin: 3.4.4. Clear:RC:0(209.85.166.43):SA:0(-2.0/5.0):. Processed in 5.034972 secs); 08 Jul 2020 17:00:18 -0000 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.43 as permitted sender) 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:cc; bh=q0ksEUUop8rbkNrtMnwe2HR+X9moRKqWcpNZVqRhkuc=; b=bkhuCOdVlNGRiR1nl5QOi8uRdpMUubh4T6A54AAYsEwBdqKUni8zrptYbaJPDEqXSd Bd6kIx9rgzLdOUqnAtS+Rc+sF0/wj8sf8s4lSdPF50FrvOAi1G/USYy4jTeOofNlH5PE Xgwipvkg/c0jW3B0SbyU0cJ92RyqtlCmCDtmX7JVncEuLa1SY3HtwbDp5eCDtDKryTIn vBQTsHh3Oc1eXAPS34fTMXfCE7pdrvsm9Fr9Wn97wqx3CQ2tpT9TE6RBmxjCW76ZUabi KaEURUkGHt/GPVakqHpxYgDap3kbRBnzC2E6SCQ4996yos2HK8oEna5zrnLtZfXqQ9fP YB7w== X-Gm-Message-State: AOAM533HXtw4bcsaZm52sgoXLZIhmwYpphWD0L1To8NV61ykKuPb+gTS wRdSgqoI0qiikQLVAvcWHT/V3duZUMXtQh9vENA= X-Google-Smtp-Source: ABdhPJyaCoErrqLUAhdTv6xlAqhMkR1JwCCQVGl8I+t9tZzST7PWdRVXSq3aVJB3RVlnr2TW0Xxst2BPS1DAmhjJiH8= X-Received: by 2002:a6b:c910:: with SMTP id z16mr37256077iof.120.1594227580799; Wed, 08 Jul 2020 09:59:40 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Mikael Magnusson Date: Wed, 8 Jul 2020 18:59:40 +0200 Message-ID: Subject: Re: zcompile does not expand aliases defined in the compiled script To: Roman Perepelitsa Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On 7/8/20, Roman Perepelitsa wrote: > On Tue, Jul 7, 2020 at 10:28 PM Mikael Magnusson wrote: >> It is possible that you changed the example in the mail without trying >> what you changed; if you have the statements >> alias x=: >> x >> in the file x, then sourcing it (non-compiled) will work > > Yes, that's exactly it. Given a script like this: > > alias x=: > x > > Sourcing it without zcompile works (`x` on the second line is > alias-expanded), but once the script is zcompiled an attempt to source > it results in an error (`x` doesn't get expanded). > > I looked at the source code of zcompile and I understand why this > happens. It makes perfect sense when zcompiling functions. It is, > however, surprising when zcompiling scripts. In general it is a good idea to not use aliases in scripts and/or functions, they are mostly intended to save typing interactively. Small details such as the above are another reason. -- Mikael Magnusson