From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id WAA17356 for ; Wed, 2 Oct 1996 22:16:01 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id IAA17257; Wed, 2 Oct 1996 08:02:55 -0400 (EDT) Resent-Date: Wed, 2 Oct 1996 08:02:55 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199610021202.OAA10512@bolyai.cs.elte.hu> Subject: Re: zsh3.0.0 bug: aliases in if-statement In-Reply-To: <199610021055.MAA21971@sgi.ifh.de> from Peter Stephenson at "Oct 2, 96 12:55:41 pm" To: pws@ifh.de (Peter Stephenson) Date: Wed, 2 Oct 1996 14:02:46 +0200 (MET DST) Cc: zsh-workers@math.gatech.edu Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368 X-Mailer: ELM [version 2.4ME+ PL27 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"0kyHs.0.ZD4.kdbKo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2187 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Peter Stephenson wrote: > "Bart Schaefer" wrote: > > IMHO, alias expansion has always happened too soon in zsh, but it greatly > > complicates matters to go around reshaping syntax trees at execution time. > > Not just too soon, I've often thought, but too much. I don't like the > following at all. > > % which ls > ls: aliased to ls -F > % foo() { command ls } > % which foo > foo () { > command ls -F > } bash, ksh and pdksh behaves similarily. Aliases should be thought as macros which expand during compile time. That's especially true for global aliases. Shell functions can do almost anything that a non-global alias can. Adding special checks for aliases in the body of comblex commands would require reparsing of the body which would make zsh much slower and the code would become more compicated. POSIX omitted aliases because shell functions have much more clear semantics and provide more functionality than aliases and they are even more portable than aliases. Zoltan