On 9/23/08, David Korn <dgk at research.att.com> wrote:
> cc: piochjennifer at googlemail.com
> Subject: Re: Re: Re: [ast-developers] More type problems
> --------
>
>
> >
> > Yes, I think it is very useful. It allows encapsulation and reuse
> > without making shell scripts to obscure. However I would appreciate
> > two changes:
> > 1. Change 'function myclass.unset' to 'function myclass.operator
> > unset' to distinguish between special shell operators such as unset,
> > create, set, add etc and user methods. This avoids name space
> > problems.
>
> The disciplines get, set append, unset are methods that can be applied
> to all variables. All other discipline methods are type specific.
> The create discipline method is only used by type definitions.
> Given the fact that set, get, and unset have been around since
> the beginning of ksh93, there would be no way to eliminate this
> without breakiing a lot of scripts.
>
>
> > 2. A new option for builtin to define shell functions, i.e.
> > builtin -T function -f libmylib myclass.mymethod
> > to load and use the function "func_myclass__mymethod" from
library libmylib.s
> o.x
>
> Each shared library can have a static function named lib_init()
> that is called with two arguments, an int (which will be 0 for
> initilaization, and a Shbltin_t pointer.
>
> You can call sh_addbuiltin("name", funptr, (void*)0) in this
> function to make the function name available.
But this function adds a builtin command and not a function. How can I
add a function via sh_addbuiltin?
Jenny
--
Jennifer Pioch, Uni Frankfurt