Date:        Wed, 9 Jan 2019 10:05:21 +0000
    From:        Geoff Clare <g...@opengroup.org>
    Message-ID:  <20190109100521.GC690@lt2.masqnet>

  | It's not obvious to me.  Alias lookup has already been done for the
  | word in that position in the input and there is nothing to suggest
  | the shell has to go back and repeat it for the replacement word.

There is also nothing to suggest that it should not - the lexer has very
little world view, all it has is its input stream of characters, and some
idea whether or not it is at a command word position - that it has previously
looked up an alias for the current position is not something it will
necessarily know, after all, that word has now been deleted.

When it tokenises the value of the alias, nothing has changed in the
state of the world, other than that we are "processing an alias" for the
word that was there before (in the old way of expressing it).   The only
difference to what was done the previous time, is that we no longer
expand that particular alias (or any others we also happen to be
currently processing.)

If the wording in the standard isn't making this clear, then it needs
fixing so that it does, as we are after all, documenting what shells
actually do, and this is something that they all do.

kre

Reply via email to