34 ms·
The site is extremely slow at the moment. In case anyone has trouble accessing it, I managed to load it, and here's the relevant bit: Well, there were othe
by mikeash 13y ago
The site is extremely slow at the moment. In case anyone has trouble accessing it, I managed to load it, and here's the relevant bit:
Well, there were other factors in play there. htmlspecialchars was a
very early function. Back when PHP had less than 100 functions and the
function hashing mechanism was strlen(). In order to get a nice hash
distribution of function names across the various function name lengths
names were picked specifically to make them fit into a specific length
bucket. This was circa late 1994 when PHP was a tool just for my own
personal use and I wasn't too worried about not being able to remember
the few function names.
- tptacek 13y agoThat can't possibly be true. I refuse to believe it.
- pygy_ 13y agoEither way, it's hillarious :-)
- zaphar 13y agoOh It makes complete and total sense. PHP was not a "language" originally. It was a collection of handy functions in Rasmus' toolbox. When it "graduated" to language, and I use that term loosely no one bothered to clean it up. No one bothered to clean it up is PHP's mantra and it explains everything that people hate about the language perfectly.
- MichaelGG 13y agoEven with the "PHP is a personal hack", it doesn't make sense. More effort goes into naming functions than writing a one-line xor "hash". I'm more inclined to believe Rasmus is trolling here. Sure, he used strlen, but it's too hard to believe functions were named with this in mind.
- ma2rten 13y agoI think the point is that it is simple to add symbols in the C source code. You simply count the number of characters and then add it in the appropriate place.
- DSMan195276 13y agoOr perhaps 'standards last forever'. By the time someone thought to say 'Oh, we should probably fix this mess we created', it's already being used in to many programs to change it out for something else.
- riffraff 13y agoyou can still deprecate in Vx and remove in Vy. I mean, I may understand keeping the strange array-is-a-hash thingy, but changing function names is easy.
- Shish2k 13y agoHeck, even without removal, PHP being "the language of sensibly named functions with a bunch of legacy aliases that you can ignore" would still be a million times better than being "the language where every single stdlib function has its own unique form of retardation" ( used in the dictionary sense, not in the able-ist sense)
- mathrawka 13y agoWell, good thing that PHP is open source and we can just pop a visit to http://museum.php.net/php2/ http://museum.php.net/php2/ to actually see that it is true.
- M4v3R 13y agoTaken from PHP 1.99 source [1]: https://dl.dropboxusercontent.com/s/e8k4n2mx1y5vsa4/Zrzut%20ekranu%202013-12-17%2008.37.01.png https://dl.dropboxusercontent.com/s/e8k4n2mx1y5vsa4/Zrzut%20... So yeah, it's true :). [1] http://museum.php.net/php2/php-1.99s.tar.gz http://museum.php.net/php2/php-1.99s.tar.gz
- xiongchiamiov 13y agoSo what I don't get is why the function names needed to be of a certain length, since he's hard-coding the buckets.
- kingkilr 13y agoIt's a joke. A clever satire. I simply refuse to believe it's real.
- jMyles 13y agoYeah, well, I for one just spit beer out of my mouth at a fucking public sports bar.
- deleted 13y ago[deleted]
- eevee 13y agoI assume because even Back In The Day, PHP functions lived in a namespace, i.e. a hash table, i.e. a thing where you want the hashes of the keys to be somewhat evenly distributed.
- TOGoS 13y agoThat he futzed around with function name lengths instead of just fixing the hash function is a pretty good analogy for both the design of the language as a whole and to much of the code that's written in it. Queue "it's popular and therefore must be good" trolls.
- jarek 13y agoHow about spelling trolls? It's "cue": "From the letter Q, abbreviation of Latin quando (“when”), marked on actor's play copy where they were to begin." - http://en.wiktionary.org/wiki/cue http://en.wiktionary.org/wiki/cue
- MarkPNeyer 13y agomaybe he wants them to line up single file?
- untog 13y ago"it's popular and therefore must be good" Feels strawman-ish, I've never heard anyone say that. "It's popular therefore it is a legitimate language choice", sure.
- jmccree 13y agoPHP was doing MVP before it was cool.
- MichaelGG 13y agoI understand it but don't get it. Why use strlen? Even a simple one-line character-xor does better. (I tested using the 354 function names from the PHP2 source code.) Why would you bother bucketing, but then take such a silly approach and actually aim to name things for length?
- dscrd 13y agoPerhaps, and I am being totally serious here, Rasmus did not know about xor.