Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Why does Perl have typeglobs?

by Anonymous Monk
on Jul 08, 2014 at 19:59 UTC ( [id://1092786]=note: print w/replies, xml ) Need Help??


in reply to Re: Why does Perl have typeglobs?
in thread Why does Perl have typeglobs?

Because they are symbol table entries ... the symbol table, where completely unrelated things (variables) are held
You know, Perl is not the only programming language that makes use of symbol tables! And other language (that I know of) dont have anything like typeglobs.
Hmm, six individual variables tables, versus one umbrella table, hmmm
? Why would you need different symbol tables? Different keys for different things would suffice. Perl's symbol table is just a hash... (well, I would be REALLY surprized if it weren't so)

But now that I think of it, yeah... It was probably an attempt to save memory. Smaller symbol tables, fewer structs in them, fewer calls to malloc... That kind of fits with the idea context. Still pretty strange. I'm sure Perl programmers don't use that feature very often, if at all.

Replies are listed 'Best First'.
Re^3: Why does Perl have typeglobs?
by choroba (Cardinal) on Jul 08, 2014 at 20:54 UTC
    Perl's symbol table is just a hash
    Indeed. A hash of hashes, in a way:
    use warnings; use strict; sub T { 42 } our $T = 24; *T = *STDOUT{IO}; print { *T{IO} } ${*T{SCALAR}}, ' ', *T{CODE}->(), "\n";
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Not a hash of hashes, a hash of globs. Not only is the syntax different, so is the implementation. A glob is a struct, not a hash table.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1092786]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-20 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found