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

Re: named references



On Jun 27,  8:18pm, Oliver Kiddle wrote:
> Subject: Re: named references
> 
> I'd be interested in more detail on the ideas you have for the
> parameter code. What sort of thing might the interface provide?
> 
> My main thoughts from what I've seen is that it would be good if it was
> more flexible so that you could have something like an array of
> assocations of floats. Maybe allow arrays of things of mixed type? What
> other types might we want other than something like ksh namespaces
> (records/structs or whatever you like to call them).

All these things are, theoretically, already possible, because the
associative array implementation uses a duplicate of the parameter
hash table -- every associative array element is itself an entire
struct param and *could* have all the attributes of any parameter.

The missing bit is the necessary syntactic constructs to allow one to
manipulate such complex data structures from shell script code.  Even
with zsh's ability to parse multi-level subscript expressions, there
isn't any way to represent the assignment of, say, an entire hash table
from one parameter to another -- assignment expressions, substitutions,
etc. inherently work on text rather than on the internal representation
of the data.  Even namerefs only allow you to pass around the names of
things, not the things themselves.

The fact that functions can't return anything but an exit status is
not helpful either.

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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