3 ms·
my mistake ... what i meant to say was lexical variables, lexical closures also needed the concept of references.
by tomneo 17y ago
my mistake ... what i meant to say was lexical variables, lexical closures also needed the concept of references.
- chromatic 17y ago> ... lexical closures also needed the concept of references. I can't imagine how that could be, unless somehow you mean that "first-class functions require references in Perl 5", which is true only insofar as first-class functions rely on the design concept of references. If Larry had invented the idea of a reference context (not the most precise term, but I think it's understandable), references would have been unnecessary in Perl 5.
- tomneo 17y ago> "first-class functions require references in Perl 5" yes thats what i meant. to put it simply. perl4 did not have lexical variables, first class functions, proper syntax for nested data structures. larry said let there be references. its one big hammer to solve all problems. i think perl6 is using a different appoach based on laziness for nested data structures. there are always strings and do blocks which assign and return globs with randomised but unique name(gensym but perls gensym is returns a GLOB reference so you have to write ur own). reference context == continuation right ?? in sub bar { ... $foo = sub { .... } ... return \$foo}, i think \$foo also captures the lexpad of bar using a single reference to $foos internals. thats all. otherwise i think one would need continuations like in ruby or scheme or perl6.