You can create as many logical name tables as you want, and you can specify that a new 
one will have, as its parent table, another of the ones you created.  So you can build 
a tree structure of name tables.  I think this could be used to implement a hash of 
hashes, even one with multiple levels.  

However!  I never meant to suggest that anyone (except a masochist) would choose to do 
this in DCL, if they had the choice of doing it in Perl.  It's a curiousity, like a 
dog walking on its hind legs.  I was feeling pleased with myself for having noticed 
that it should be possible.  But its only practical importance would be to someone for 
whom Perl wasn't an option.  

/ Tom Edelson


-----Original Message-----
From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, September 04, 2002 8:10 AM
To: [EMAIL PROTECTED]
Subject: RE: Perl vs. DCL (was RE: Set Default not Working)



"Tom Edelson" <[EMAIL PROTECTED]> writes:

> > * Perl does lists and hashes _much_ better than DCL;

> I agree, but the advantage isn't quite as enormous as some people 
> think, because they haven't noticed that DCL does have built-in 
> support for hashes.  It just calls them logical name tables ....

I've been using the DCL symbol table itself for both hash and array, but it's 
cumbersome, and as Sandy Fleming points out you can't hash just anything. Hashes of 
hashes using the symbol table would work the same way as "old-style" multilevel hashes 
in Perl - mung all the keys into
(effectively) one big honkin' one:

$ addr_edelson_tom = "[EMAIL PROTECTED]"
$ addr_fleming_sandy = "[EMAIL PROTECTED]"
$ addr_wyant_tom = "[EMAIL PROTECTED]"
$ if f$type (addr_'p2'_'p1') .eqs. ""
$ then
$ write sys$output p1, " ", p2, "'s address is unknown."
$ else
$ addr = addr_'p2'_'p1'
$ write sys$output p1, " ", p2, "'s address is ", addr, "."
$ endif

I think that the creation of the 'hash table' is little if any longer than the Perl 
hash-of-hashes implementation, but it takes seven lines of DCL to access the 'hash 
table', versus one for Perl, and the DCL flunks badly on out-of-band input. Use of a 
logical name table would allow traversal of the whole table, but you'd have to do 
cleanup afterwards, and the out-of-band character issues are the same.

On the other hand, there's no good place for 'sting', 'enya', or 'eminem' in the Perl 
hash-of-hashes implementation (maybe a good thing, depending on your tastes).

Tom Wyant

Reply via email to