[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extensions to settor variables?



>>>>>  Arnold Robbins <arnold@cc.gatech.edu> writes:

:> I may have mentioned this before on this list.  Ksh-93 takes settor
:> variables two steps further.  You can supply functions that are called
:> when a variable is a) set, b) referenced, and c) unset.  They are called
:> discipline functions in ksh.

That's one step, not two.  Unsetting in es is done by assigning the
empty list, and that executes the settor function:

; set-foo=@ f{echo foo set to $f; result $f}
; foo=arf arf
foo set to arf arf
; foo=
foo set to

so the only thing es lacks, is (b).  I must admit executing a function
every time a variable is referenced seems a bit overwhelming to me.
This creature doesn't feep, it galumphes!

What are the uses for such things anyway?  (I mean the reference
discipline).

- Harald