Garrett D'Amore wrote:
> Nicolas Williams wrote:
> > On Thu, Jun 12, 2008 at 08:34:33PM -0700, Garrett D'Amore wrote:
[snip]
> The question isn't about discouraging scripting, but rather, how far do
> we want to go to enable people to use a shell script to perform
> something that they really probably should have a better tool for?
>
> I get the feeling that we're trying to represent what is really
> structured data, to a language that doesn't have even the slightest
> concept of data structures.
Erm... I suggest to stop designing stuff around the old Bourne shell or
treating all shells like the Bourne shell (if we go down to that level
we can easily _lower_ it by making the Thomson shell (predecessor of the
Bourne shell) the _minimum_ level for this case. IMO a reasonable
_minimum_ level should be the POSIX shell specification - which would
solve lots of trouble this case has...).
For example ksh93 has support for |struct|-like variables which can be
nested like this:
-- snip --
$ ksh93 -c 'x=( a=5 b="hello" c=( d=9 e="hello world" ) ) ; print "$x"'
(
a=5
b=hello
c=(
d=9
e='hello world'
)
)
-- snip --
This kind of variable tree can be nested without any limits - see
http://www.nrubsig.org/people/gisburn/work/sun/xserver_license_extractor/X-src-20071107_XW_NV_open-src_tarballs_extraced_comments20080331.cpv
for a simply example of an array value.
The largest variable tree so far on production systems contained ~~30GB
(GigaBytes!!) of data (and it was _not_ slower than a JAVA or C++
application to build and crawl the tree (e.g. stop speading the "FUD"
that "shells are slow". It may apply to the Bourne shell but the shells
did evolve since that a bit...)).
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)