Newsgroups: comp.lang.tcl,comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!news2.near.net!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!swrinde!news.uh.edu!uuneo.neosoft.com!nmtigw!peter
From: peter@nmti.com (Peter da Silva)
Subject: Re: An alternative to Tcl, python, etc...
Message-ID: <id.0BLD1.NF2@nmti.com>
Sender: peter@nmti.com (peter da silva)
Organization: Network/development platform support, NMTI
References: <36ql26$iar@mathserv.mps.ohio-state.edu> <36rtlm$ave@mathserv.mps.ohio-state.edu> <id.3DKD1.Z13@nmti.com> <DGAY.94Oct5090233@litsun13.epfl.ch>
Date: Wed, 5 Oct 1994 18:19:46 GMT
Lines: 34
Xref: glinda.oz.cs.cmu.edu comp.lang.tcl:19977 comp.lang.scheme:10269

In article <DGAY.94Oct5090233@litsun13.epfl.ch>,
Gay David <dgay@litsun13.epfl.ch> wrote:
> An associative array generally involves some hashing function + search time.
> Even in an interpreter, a structure reference can be done by indexing (you
> might have to fetch the index indirectly, but this isn't all that expensive).

In an interpreter, you need to look up the index or a structure element name
in a symbol table. Whether the syntax is:

	foo.bar

or:

	foo["bar"]

the cost of parsing this is the same in either case. Now you're talking about
an interpreter-compiler, perhaps? One that creates a p-code that's run through
a second level of interpretation. OK, in that case the cost of using a struct
or an associative array with a fixed index is still the same. You can store the
offset of that index in the p-code as easily as you can store the offset of
the structure element.

Semantically associative arrays are a superset of structures, and for the
area where they intersect the only performance differences are a quality of
implementation issue.

Associative arrays *also* have the ability to use computed indexes, but I'm
not considering that case because that's a facility you don't have at all
with structures. That's why they're a superset.
-- 
Peter da Silva                                            `-_-'
Network Management Technology Incorporated                 'U`
1601 Industrial Blvd.     Sugar Land, TX  77478  USA
+1 713 274 5180                       "Hast Du heute schon Deinen Wolf umarmt?"
