ksh93 style named references - semantics references to references allowed, so: $ val=fred $ typeset -n ref=val $ typeset -n word=ref $ echo $word fred can point to an unset variable: $ unset val $ typeset -n ref=val $ echo $ref $ echo $val can point to array, assoc etc and will be treated as such: $ arr=(one two three) $ typeset -n val=arr $ echo ${val[1]} two but cannot point to an array element: $ typeset -n val=arr[1] ksh: typeset: arr[1]: is not an identifier also, the element of an array, assoc can not be a reference, just as it can't be a float etc: $ typeset -n ref[1]=val ksh: typeset: ref: reference variable cannot be an array but can't point to an invalid variable name: $ typeset -n ref=1val ksh: typeset: 1val: invalid variable name or to nothing: $ typeset -n ref ksh: typeset: ref: no reference name $ typeset -n r='' ksh: typeset: : is not an identifier or to a positional parameter cycles and self-references blocked $ typeset -n ref=val $ typeset -n val=ref ksh: typeset: val: invalid self reference references can't be exported local applies to the reference not the variable attributes apply to the value not the reference: $ typeset -n val=one $ typeset -n ref=val $ typeset -u ref $ echo $ref ONE $ echo $val ONE this includes readonly in ksh though: $ typeset -n -r ref=val ksh: typeset: ref: is read only might be good if this would define ref as a readonly reference dereference with ${!...} $ typeset -n ref=val $ echo ${!ref} val dereference goes all the way so $ typeset -n ref=val $ typeset -n ref2=ref $ echo ${!ref2} val ksh has compiled in alias - nameref='typeset -n' typeset +n lists names of reference variables typeset -n lists reference variables with values only with -n will typeset act on the reference not the value unset applies to the referenced variable unset has a -n option which will unset the actual reference typeset +n ref converts ref to a scalar in ksh, references to positional variables are not allowed: $ typeset -n val=3 ksh: typeset: 3: invalid variable name if ksh is given an nameref as the index to a for loop it assigns the values as for the reference, not the value. It could be very useful but isn't what what you'd first expect. Is there a good alternative to avoid this: $ typeset -n ref=dummy $ for ref in var1 var2 ... in ksh, typeset -n ref[one]=val is allowed with [one] ignored reference records the local level so: $ function f { $ typeset -n ref=val $ typeset val=two $ echo $ref $ } $ val=one $ f val would echo `one' because of the above, it needs to handle the situation where unset ref is done in the function above and also where ref is then also reassigned a value. ksh is not clever enough to allow typeset -n ref=ref in a function though Extra issues in zsh: local should be implied for typeset -n without +l. what should ${(t)ref} return - the same as what it refers to with -nameref- inserted? should we use namerefs for prompt, rprompt, PROMPT-PROMPT4? how messy will references to specials be? might we need special references - I hope not. any uses in completion functions? _call_function for starters. test vared, read, case etc