On 9/21/08, Jennifer Pioch <piochjennifer at googlemail.com> wrote:
> On 9/18/08, David Korn <dgk at research.att.com> wrote:
> > cc: ast-developers at research.att.com
> > Subject: Re: Re: [ast-developers] More type problems
> > --------
> >
> >
> >
> > > There is still a problem if A_t contains an array declaration like
> > >
> > > typeset -T A_t=(
> > > B_t -a b
> > > )
> > >
> > > This causes a segmentation fault.
> > >
> > >
> >
> >
> > I hadn't considered this case so this is a bug.
> >
> > Do you think that this object oriented extension to ksh93 will be
> > useful?
>
>
> 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.
> 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.so.x
Further thinking: (2) may be implemented by
function myclass.mymethod
{
integer -S loaded=0
if (($loaded==0))
then
loaded=1;builtin -f libmylib "func_myclass__mymethod"
|| exit 120
fi
"func_myclass__mymethod" "$@"
return $?
}
but builtin -T func -l libmylib myclass.mymethod would be easier.
Jenny
--
Jennifer Pioch, Uni Frankfurt