Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: Why does Perl have typeglobs?

by Anonymous Monk
on Jul 08, 2014 at 19:59 UTC ( #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 (Bishop) 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?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2019-08-22 08:54 GMT
Find Nodes?
    Voting Booth?

    No recent polls found