Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: creating user defined special parameters?

On Jan 9,  1:38am, Atom Smasher wrote:
} is there a way, from within the shell, to create a special parameter?

No; zsh has not yet implemented ksh "discipline functions," nor the
compound-type semantics of ksh's "typeset -T".

In part this is because of what should be a simple parsing issue; the
syntax Korn invented for compound variables is to embed a "." in the
name, e.g. ${foo.fud} is the "fud" field of base variable "foo".  But
zsh's parser for parameter names inside ${ } is the same as that used
for "bare" $foo.fud, which historically must be parsed ${foo}.fud --
and this same parser is used all over the internals as a test for valid
"identifier" token syntax, so simply adding "." to the list of allowed
characters in an identifier induces massive breakage.

It would be possible to implement an equivalent of discipline functions
as a module, but whenever it has come up it's been backburnered until
the naming syntax problem can be addressed -- no point in deliberately
inventing a differently-shaped version of this wheel.

Messages sorted by: Reverse Date, Date, Thread, Author