zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: ZSH User List <zsh-users@sunsite.auc.dk>
Subject: Re: strange alias effects
Date: Mon, 29 May 2000 17:24:46 +0000	[thread overview]
Message-ID: <1000529172446.ZM1660@candle.brasslantern.com> (raw)
In-Reply-To: <20000529122714.B26887@br-online.de>
In-Reply-To: <200005291332.PAA13192@beta.informatik.hu-berlin.de>

On May 29, 12:27pm, Andy Spiegl wrote:
} Subject: Re: strange alias effects
}
} Bart Schaefer wrote,
} 
} > Did you happen to compile your dot-files with zcompile?
} No, never used that.
} And the same dot-files worked perfectly with 3.1.6.pws21.
} 
} > It's the same problem as "Bart Schaefer's rule" in FAQ 2.3

I misspoke slightly there.  It's the same as *the reason for* the rule,
which says:

 Define first those aliases you expect to use in the body of a function,
 but define the function first if the alias has the same name as the
 function.

On May 29,  3:32pm, Sven Wischnowsky wrote:
} Subject: Re: strange alias effects
}
} It was always the case that syntactical constructs like if/then/else
} and loops were parsed completely.  [...]  When it is executed, the alias
} is defined, but in this case the functions are already parsed, too.

And the effect of zcompile is that the entire file is parsed as one big
syntactic construct, so no aliases defined within the file are expanded
within the file. [*]

[*] Unless you first "source" the file to define them, and then compile
it with*out* using -U ... but that can also have unexpected results if
you have global aliases (alias -g).

Sven went on:
} It isn't special to zsh, either. All shells (have to) behave this way.

Csh doesn't, but then csh doesn't have functions.  Csh (the original one
from the old BSD Unix) parses and executes syntactic constructs in the
same pass; loops are, in effect, implemented with fseek.  It used to be
possible to create some pretty entertaining csh scripts that rewrote the
script file in place while it was executing.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  parent reply	other threads:[~2000-05-29 17:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-29  9:56 Andy Spiegl
2000-05-29 10:13 ` Bart Schaefer
2000-05-29 10:27   ` Andy Spiegl
2000-05-29 13:32     ` Sven Wischnowsky
2000-05-29 13:47       ` Andy Spiegl
2000-05-29 17:24       ` Bart Schaefer [this message]
2000-05-29 11:44 ` Andrej Borsenkow
2000-05-29 12:06   ` Andrej Borsenkow
2000-05-29 12:13     ` Andy Spiegl
2000-05-29 12:30       ` Andrej Borsenkow
2000-05-29 12:59         ` Andy Spiegl
     [not found]           ` <000301bfc96e$cf7af2b0$21c9ca95@mow.siemens.ru>
2000-05-29 13:13             ` Andy Spiegl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1000529172446.ZM1660@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).