On Tuesday, July 16, 2013 04:39:16 PM you wrote: > cc: [email protected] > Subject: Re: Re: [ast-users] Can't pass parameters to an instance constructor > -------- > You are correct that just as the "TYPES" document describes, ksh93 > does support a create function. I completely forgot about this and it > is also in the man page. > > However, it is invoked when instance is created before the > fields have been modifed by assignment as if it were created as > Type foo > (foo.x=q foo.y=z) > > My concern with changing it is that this could mean that > you can't save and restore a shell environment using > typeset -T and typeset -p and putting it in a file and > then dotting the file to restore it since the > initialization function will get called twice.
I'd think that you would want to save type definitions using `.sh.type.MyType', which would include the initial default values for fields. Then the actual objects with `typeset -p obj', or `print -r "$obj"' or `print -v obj'. The initialization function would always work off the type definition so the results should always be the same. It currently looks like none of these include a representation for any functions that are members of either types or objects, so you can't really save/restore the shell's state right now anyway. -- Dan Douglas _______________________________________________ ast-users mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-users
