go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I was re-reading Paul Graham's web articles (http://paulgraham.com/hundred.html) and thinking about how Perl might adapt for computers with processing power many orders of magnitude better than what we have. I wasn't thinking practically, nor particularly critically, but I was thinking about it with Paul's LISPoCentric view.
Imagine the runtime inefficiency (yet potential elegance) of treating strings as lists of characters -- or references to lists of characters -- and treating hashes as lists of list-pairs. You know how, in Perl, you declare a hash as a flat array, and Perl sorts it out for you? What if, in the future, Perl actually stores all data internally as lists? Something strange I've just realized is how completely I've forgotten that strings really are "arrays" in C. "Modern" languages have taught me to forget the internal representation of strings and treat them as atomic. One odd thing about strings being represented internally as lists is that the quote characters become an alias for list declaration. Another odd thing is that sigils might converge. Imagine my blurry view of Perl7. Pardon my lack of semicolons, I'm seeing what it would feel like to not use them all the time in Perl. It turns out there are lots of things that might cause problems (maybe because I'm too used to thinking of scalars as strings) that might be remedied by throwing out the $ sigil and using the @, or, alternately, trying to remember that everything's a reference to a list. Or something. It occurs to me that this behavior might be implemented today with a module. I'll have to think about this a bit. I've never written a module that fundamentally changes the look (or behavior) of the language. It would feel strange calling split() on a list.
Edit by castaway - swapped pre tags for code tags In reply to Representing all data as Lists (Perl7?) by rje
|
|