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

Re: wrapper functions in modules



On Dec 16,  9:05am, Sven Wischnowsky wrote:
} Subject: Re: wrapper functions in modules
}
} Bart Schaefer wrote:
} 
} > On Dec 15,  1:03pm, Sven Wischnowsky wrote:
} > }
} > } Bart Schaefer wrote:
} > } > Is the new first parameter of doshfunc() needed any longer?
} > } 
} > } [For those who don't want to look at the code: the argument is the
} > } name of the function to be executed.]
} > } 
} > } I added the argument since modules may be interested in it
} > 
} > Hm.  I'm not sure that modules *ought* to be interested in it, but...
} 
} I wouldn't resist to remove this or to use a global variable for it.

A parameter is almost always better than a global, for things that get
stacked and restored like this.

} > One thing a wrapper function might legitimately be interested in is the
} > context in which it was called.
} 
} Yes, that would be good to have. Using a global integer variable or an 
} argument and a couple of constants?

Here a global makes more sense, since it only changes once as you enter
(say) the completion code and remains constant all the way down the
shell function call chain.

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



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