subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
lolphp | merreborn | cjy2kk4 | <|soss|><|sot|>Something snarky for you folks to post.<|eot|><|sost|>http://www.reddit.com/r/awesomephp is a thing. As long as I moderate it, it will not change from its state today :)<|eost|><|sor|>I thought to myself, "okay, if someone was to seriously make a subreddit like that, not as a joke, what would it contain?". I figured the top posts in /r/php might be a good start.
Then I saw that [this is the top post of all time in /r/php](http://www.reddit.com/r/PHP/comments/25mdqi/10_things_i_learned_from_rphp/). Quality content.
[The other top posts aren't much better.](http://www.reddit.com/r/PHP/top/?sort=top&t=all)
You're not helping, /r/php<|eor|><|eoss|><|endoftext|> | 21 |
lolphp | ladaghini | cjy8ifw | <|soss|><|sot|>Something snarky for you folks to post.<|eot|><|sost|>http://www.reddit.com/r/awesomephp is a thing. As long as I moderate it, it will not change from its state today :)<|eost|><|sor|>I think there's room for [one submission](http://elabs.se.s3.amazonaws.com/uploads/picture/file/81/normal_php_-_the_good_parts.jpeg).<|eor|><|eoss|><|endoftext|> | 19 |
lolphp | cfreak2399 | cjyajp7 | <|soss|><|sot|>Something snarky for you folks to post.<|eot|><|sost|>http://www.reddit.com/r/awesomephp is a thing. As long as I moderate it, it will not change from its state today :)<|eost|><|sor|>This post http://www.reddit.com/r/PHP/comments/s345g/php_sucks_but_i_like_it/
Reads like people stuck in an abusive relationship.
<|eor|><|eoss|><|endoftext|> | 13 |
lolphp | gavintlgold | cjxuk92 | <|soss|><|sot|>Something snarky for you folks to post.<|eot|><|sost|>http://www.reddit.com/r/awesomephp is a thing. As long as I moderate it, it will not change from its state today :)<|eost|><|sor|>You should modify the CSS so it looks like the page doesn't exist :P<|eor|><|eoss|><|endoftext|> | 9 |
lolphp | totes_meta_bot | cjyaxk2 | <|soss|><|sot|>Something snarky for you folks to post.<|eot|><|sost|>http://www.reddit.com/r/awesomephp is a thing. As long as I moderate it, it will not change from its state today :)<|eost|><|sor|>This thread has been linked to from elsewhere on reddit.
- [/r/programmingcirclejerk] [PHP deserves no better](http://np.reddit.com/r/programmingcirclejerk/comments/2ed3ky/php_deserves_no_better/)
*^If ^you ^follow ^any ^of ^the ^above ^links, ^respect ^the ^rules ^of ^reddit ^and ^don't ^vote ^or ^comment. ^Questions? ^Abuse? [^Message ^me ^here.](http://www.reddit.com/message/compose?to=%2Fr%2Fmeta_bot_mailbag)*
<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | VeXCe | cjy9fhy | <|soss|><|sot|>Something snarky for you folks to post.<|eot|><|sost|>http://www.reddit.com/r/awesomephp is a thing. As long as I moderate it, it will not change from its state today :)<|eost|><|sor|>My god, what have I done?!<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | tdammers | cjynld9 | <|soss|><|sot|>Something snarky for you folks to post.<|eot|><|sost|>http://www.reddit.com/r/awesomephp is a thing. As long as I moderate it, it will not change from its state today :)<|eost|><|sor|>This post http://www.reddit.com/r/PHP/comments/s345g/php_sucks_but_i_like_it/
Reads like people stuck in an abusive relationship.
<|eor|><|sor|>That's because that's exactly what it is.<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | Banane9 | cjxvgld | <|soss|><|sot|>Something snarky for you folks to post.<|eot|><|sost|>http://www.reddit.com/r/awesomephp is a thing. As long as I moderate it, it will not change from its state today :)<|eost|><|sor|>So does /r/wowphp now :)<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | PlasmaSheep | 26culy | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|eols|><|endoftext|> | 31 |
lolphp | andsens | chpwgtg | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|eols|><|endoftext|> | 28 |
lolphp | allthediamonds | chpz655 | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>lol @ "optimized"<|eor|><|eols|><|endoftext|> | 28 |
lolphp | ahruss | chq0w6t | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>How did someone write this page and not realize everything about arrays is terrible?
> The above will appear to have two keys named 'AA', although one of them is actually named '\0A\0A'.<|eor|><|eols|><|endoftext|> | 21 |
lolphp | DoctorWaluigiTime | chpzzqn | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>I'd imagine it is, because now this one class (array) can be (mis)used as any of the above types at any time, unintentionally or otherwise. If you want a list, has table, dictionary, etc, have different types defined for them. One-size-fits-all is a direct violation of the Single Responsibility Principle.<|eor|><|eols|><|endoftext|> | 16 |
lolphp | allthediamonds | chqb3we | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>We say this like it's an obvious lie.
You can't optimize for all those cases. Period. What PHP ended up with is an unusable, glorified dictionary-meets-vector which is optimized for few (if any) of those cases.<|eor|><|sor|>Unusable? I think you just mean versatile.<|eor|><|sor|>It could be nice if we had it *as well as proper alternatives*. It's like if I asked for a sink, a toilet and a fridge, and you gave me three holes on the floor. "See, it's versatile", you say, as I stab you in the face.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | allthediamonds | chq55vk | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>We say this like it's an obvious lie.
You can't optimize for all those cases. Period. What PHP ended up with is an unusable, glorified dictionary-meets-vector which is optimized for few (if any) of those cases.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | smog_alado | chq9zsr | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>I'd imagine it is, because now this one class (array) can be (mis)used as any of the above types at any time, unintentionally or otherwise. If you want a list, has table, dictionary, etc, have different types defined for them. One-size-fits-all is a direct violation of the Single Responsibility Principle.<|eor|><|sor|>Dunno if one size fits all is really that bad. Lua has a single table data structure that is used for arrays, hash tables, objects etc and it actually works quite well and helps keep the language much simpler.
The problem is that, unlike Lua, PHP has lots of quirky behaviour and the arrays are not that efficient.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | skillet-thief | chq1mzd | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>The ambiguity between "hash keys" and "vector indexes" in PHP is a huge source of possible bugs. <|eor|><|eols|><|endoftext|> | 9 |
lolphp | vita10gy | chrneg3 | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>If you make fun of PHP, you're kind of an asshole.
If you defend PHP, you're kind of an asshole.<|eor|><|sor|>Welcome to the internet, my friend.<|eor|><|sor|>It's almost as if it's a collection of multiple individuals whose opinions differ on things.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | captainramen | chr1gst | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>I'd imagine it is, because now this one class (array) can be (mis)used as any of the above types at any time, unintentionally or otherwise. If you want a list, has table, dictionary, etc, have different types defined for them. One-size-fits-all is a direct violation of the Single Responsibility Principle.<|eor|><|sor|>Dunno if one size fits all is really that bad. Lua has a single table data structure that is used for arrays, hash tables, objects etc and it actually works quite well and helps keep the language much simpler.
The problem is that, unlike Lua, PHP has lots of quirky behaviour and the arrays are not that efficient.<|eor|><|sor|>There's a penalty you pay for that. Looks like there's [a lot of premature optimization](http://stackoverflow.com/a/12865406/408866) you need to do when writing LUA. This is not necessarily a bad thing, I am sure there are some contexts where this is a valid trade off.
It's extremely rare for one size fits all to actually work. I could write a litany about projects where the solution space was engineered to solve any problem you could possibly ever have (in the name of reuse) instead of just engineering the solution to fit the problem. These projects rarely succeed.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | gu3st12 | chpxwex | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|eols|><|endoftext|> | 6 |
lolphp | smog_alado | chr3e4n | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>I'd imagine it is, because now this one class (array) can be (mis)used as any of the above types at any time, unintentionally or otherwise. If you want a list, has table, dictionary, etc, have different types defined for them. One-size-fits-all is a direct violation of the Single Responsibility Principle.<|eor|><|sor|>Dunno if one size fits all is really that bad. Lua has a single table data structure that is used for arrays, hash tables, objects etc and it actually works quite well and helps keep the language much simpler.
The problem is that, unlike Lua, PHP has lots of quirky behaviour and the arrays are not that efficient.<|eor|><|sor|>There's a penalty you pay for that. Looks like there's [a lot of premature optimization](http://stackoverflow.com/a/12865406/408866) you need to do when writing LUA. This is not necessarily a bad thing, I am sure there are some contexts where this is a valid trade off.
It's extremely rare for one size fits all to actually work. I could write a litany about projects where the solution space was engineered to solve any problem you could possibly ever have (in the name of reuse) instead of just engineering the solution to fit the problem. These projects rarely succeed.<|eor|><|sor|>First of all, saying that there are optimizations that you NEED to use to code in Lua^1 is a bit disengenuous. When it comes to scripting languages, your average Lua code is likely to be faster than your average Python, Ruby or PHP code and many of the issues highlighted in that article you linked are also things to care about in other scripting languages:
* avoiding globals: this is a good thing even in compiled languages like C. Globals need to be read and flushed to memory because you never know who might need to access it. On ther other hand, locals can be stored in registers and are more amenable to optimization.
* Avoid string creation: This is mostly a side effect of strings being immutable - Python has a very similar problem^2.
* Avoid function overhead: In most scripting languages, function calls are more expensive than straight code. That said, Lua function calls are cheaper than function calls in Python or PHP and some of the examples he gives (ipairs, table.insert) are a bit of overkill.
* Avoid frequent table creation: Object allocation is implicit in almost any object oriented language. You only really need to care about these allocations if you are in the hot loop for your code (additionalyl, LuaJIT has a couple of optimizations to avoid some kinds of allocations)
* Memoization: This is an algorithmic decision.
That said, of course there are some issues in using a single table type but they don't really have to do with performance. The biggest ones I can think of right now:
* You can't store `nil` in table fiends and arrays; Storing `nil` in an array will mess up its length. (If you need to use nil in arrays the workaround is to use `false` instead or to keep track of the length yourself)
* Lua has no special syntax for classes (objects are just tables and methods are just table fields that happen to be functions). Method calls need to be written using the `obj:method()` notation instead of `obj.method()`.
--------
^1 The language name is not written in allcaps, BTW. The language name means Moon in Portuguese :)
^2 - CPython now has a specific optimization for concatenating strings in a loop but some other implementations still exibit quadratic behavior.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | djsumdog | ci3nb8b | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>How did someone write this page and not realize everything about arrays is terrible?
> The above will appear to have two keys named 'AA', although one of them is actually named '\0A\0A'.<|eor|><|sor|>> Floats are also cast to integers, which means that the fractional part will be truncated. E.g. the key 8.7 will actually be stored under 8.
>Bools are cast to integers, too, i.e. the key true will actually be stored under 1 and the key false under 0.
>Null will be cast to the empty string, i.e. the key null will actually be stored under "".
>Arrays and objects can not be used as keys. Doing so will result in a warning: Illegal offset type
... ... ... hmm
...
..
.
<|eor|><|eols|><|endoftext|> | 5 |
lolphp | nahguri | chvqpax | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>Maps, lists, stacks and sets are completely different things for completely different applications. Why the fuck would someone squeeze these (and more, as the manual says) into a single type?
Throw in the infamous weak typing and confusing clusterfuck is complete.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | gu3st12 | chq99f3 | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>We say this like it's an obvious lie.
You can't optimize for all those cases. Period. What PHP ended up with is an unusable, glorified dictionary-meets-vector which is optimized for few (if any) of those cases.<|eor|><|sor|>Unusable? I think you just mean versatile.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | captainramen | chr1lwh | <|sols|><|sot|>"An array in PHP is actually an ordered map."<|eot|><|sol|>http://www.php.net/manual/en/language.types.array.php<|eol|><|sor|>> This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
They say this like it's a good thing?<|eor|><|sor|>You say this like it's a bad thing?<|eor|><|sor|>We say this like it's an obvious lie.
You can't optimize for all those cases. Period. What PHP ended up with is an unusable, glorified dictionary-meets-vector which is optimized for few (if any) of those cases.<|eor|><|sor|>Unusable? I think you just mean versatile.<|eor|><|sor|>What benefit do you think this actually gives you, the consuming developer? OMG I have to remember an additional 6 words!<|eor|><|eols|><|endoftext|> | 5 |
lolphp | frezik | 1dhw9t | <|soss|><|sot|>How the phpBB MODX format must have been made<|eot|><|sost|>Another example of fractal badness, where an original bad decision somewhere causes further bad decisions to work around the problems encountered, leading to yet more bad decisions, etc.
The MODX format is used by phpBB for extending the system. Many years ago, I had the misfortune to try to setup a phpBB with a few extensions, and quickly found out that the devs had no idea what they were doing.
----
Montesquieu: Guise! Our poorly-conceived, bug-ridden, security-flawed BB system is taking over the world, but people want to extend it to be even more bug-ridden and security-flawed.
Simplicio: OK, that's normally done by a module system with carefully thought out hooks. Does PHP support any such thing?
Montesquieu: No, and I don't see why it should, and we didn't build it like that in the first place.
Simplicio: Right, so mods are going to have to write code directly into the existing source files. Is there a way to keep different tools from stepping on each other?
Montesquieu: I'm sure we'll figure something out. But right now, we need to figure out how to format changes so people know where to copy-and-paste code into the existing system, and also alter database tables.
Simplicio: Aren't there already several available diff formats for that, which already have tools available to create and apply changes automatically? And we can just throw the database alterations into their own SQL script files.
Montesquieu: Sure, but none of that stuff was invented here, so we need to make our own format. And this is the early 2000s, so we need to make it XML because XML is the future and stuff.
Simplicio: So who is going to create the tools to apply these updates automatically?
Montesquieu: I have no idea, but those tools will probably be broken and useless for several years to come.
Simplicio: Good, looks like we have all the bases covered.<|eost|><|eoss|><|endoftext|> | 30 |
lolphp | duskwuff | c9qhuot | <|soss|><|sot|>How the phpBB MODX format must have been made<|eot|><|sost|>Another example of fractal badness, where an original bad decision somewhere causes further bad decisions to work around the problems encountered, leading to yet more bad decisions, etc.
The MODX format is used by phpBB for extending the system. Many years ago, I had the misfortune to try to setup a phpBB with a few extensions, and quickly found out that the devs had no idea what they were doing.
----
Montesquieu: Guise! Our poorly-conceived, bug-ridden, security-flawed BB system is taking over the world, but people want to extend it to be even more bug-ridden and security-flawed.
Simplicio: OK, that's normally done by a module system with carefully thought out hooks. Does PHP support any such thing?
Montesquieu: No, and I don't see why it should, and we didn't build it like that in the first place.
Simplicio: Right, so mods are going to have to write code directly into the existing source files. Is there a way to keep different tools from stepping on each other?
Montesquieu: I'm sure we'll figure something out. But right now, we need to figure out how to format changes so people know where to copy-and-paste code into the existing system, and also alter database tables.
Simplicio: Aren't there already several available diff formats for that, which already have tools available to create and apply changes automatically? And we can just throw the database alterations into their own SQL script files.
Montesquieu: Sure, but none of that stuff was invented here, so we need to make our own format. And this is the early 2000s, so we need to make it XML because XML is the future and stuff.
Simplicio: So who is going to create the tools to apply these updates automatically?
Montesquieu: I have no idea, but those tools will probably be broken and useless for several years to come.
Simplicio: Good, looks like we have all the bases covered.<|eost|><|sor|>Oh, the reality is even worse. The MODX format was an XMLization of an existing text-based format. The original format was already bad (it was basically a plain-English diff file), but there were at least tools that worked with it. The XML was a gratuitous addition around the release of phpBB 3.
Possibly the worst part of the phpBB mod situation is that the presence of mods often makes it impossible to cleanly upgrade the software. A lot of forum admins deal with this by ignoring upgrades. :(<|eor|><|eoss|><|endoftext|> | 10 |
lolphp | infinull | c9qnikc | <|soss|><|sot|>How the phpBB MODX format must have been made<|eot|><|sost|>Another example of fractal badness, where an original bad decision somewhere causes further bad decisions to work around the problems encountered, leading to yet more bad decisions, etc.
The MODX format is used by phpBB for extending the system. Many years ago, I had the misfortune to try to setup a phpBB with a few extensions, and quickly found out that the devs had no idea what they were doing.
----
Montesquieu: Guise! Our poorly-conceived, bug-ridden, security-flawed BB system is taking over the world, but people want to extend it to be even more bug-ridden and security-flawed.
Simplicio: OK, that's normally done by a module system with carefully thought out hooks. Does PHP support any such thing?
Montesquieu: No, and I don't see why it should, and we didn't build it like that in the first place.
Simplicio: Right, so mods are going to have to write code directly into the existing source files. Is there a way to keep different tools from stepping on each other?
Montesquieu: I'm sure we'll figure something out. But right now, we need to figure out how to format changes so people know where to copy-and-paste code into the existing system, and also alter database tables.
Simplicio: Aren't there already several available diff formats for that, which already have tools available to create and apply changes automatically? And we can just throw the database alterations into their own SQL script files.
Montesquieu: Sure, but none of that stuff was invented here, so we need to make our own format. And this is the early 2000s, so we need to make it XML because XML is the future and stuff.
Simplicio: So who is going to create the tools to apply these updates automatically?
Montesquieu: I have no idea, but those tools will probably be broken and useless for several years to come.
Simplicio: Good, looks like we have all the bases covered.<|eost|><|sor|>I could have died happy not knowing this exists.
Now, I'm not sure what I'm going to do.<|eor|><|eoss|><|endoftext|> | 8 |
lolphp | jerenept | c9r32br | <|soss|><|sot|>How the phpBB MODX format must have been made<|eot|><|sost|>Another example of fractal badness, where an original bad decision somewhere causes further bad decisions to work around the problems encountered, leading to yet more bad decisions, etc.
The MODX format is used by phpBB for extending the system. Many years ago, I had the misfortune to try to setup a phpBB with a few extensions, and quickly found out that the devs had no idea what they were doing.
----
Montesquieu: Guise! Our poorly-conceived, bug-ridden, security-flawed BB system is taking over the world, but people want to extend it to be even more bug-ridden and security-flawed.
Simplicio: OK, that's normally done by a module system with carefully thought out hooks. Does PHP support any such thing?
Montesquieu: No, and I don't see why it should, and we didn't build it like that in the first place.
Simplicio: Right, so mods are going to have to write code directly into the existing source files. Is there a way to keep different tools from stepping on each other?
Montesquieu: I'm sure we'll figure something out. But right now, we need to figure out how to format changes so people know where to copy-and-paste code into the existing system, and also alter database tables.
Simplicio: Aren't there already several available diff formats for that, which already have tools available to create and apply changes automatically? And we can just throw the database alterations into their own SQL script files.
Montesquieu: Sure, but none of that stuff was invented here, so we need to make our own format. And this is the early 2000s, so we need to make it XML because XML is the future and stuff.
Simplicio: So who is going to create the tools to apply these updates automatically?
Montesquieu: I have no idea, but those tools will probably be broken and useless for several years to come.
Simplicio: Good, looks like we have all the bases covered.<|eost|><|sor|>Are there *any* good open-source forum packages?<|eor|><|sor|>Discourse? <|eor|><|eoss|><|endoftext|> | 7 |
lolphp | frezik | c9qi5w2 | <|soss|><|sot|>How the phpBB MODX format must have been made<|eot|><|sost|>Another example of fractal badness, where an original bad decision somewhere causes further bad decisions to work around the problems encountered, leading to yet more bad decisions, etc.
The MODX format is used by phpBB for extending the system. Many years ago, I had the misfortune to try to setup a phpBB with a few extensions, and quickly found out that the devs had no idea what they were doing.
----
Montesquieu: Guise! Our poorly-conceived, bug-ridden, security-flawed BB system is taking over the world, but people want to extend it to be even more bug-ridden and security-flawed.
Simplicio: OK, that's normally done by a module system with carefully thought out hooks. Does PHP support any such thing?
Montesquieu: No, and I don't see why it should, and we didn't build it like that in the first place.
Simplicio: Right, so mods are going to have to write code directly into the existing source files. Is there a way to keep different tools from stepping on each other?
Montesquieu: I'm sure we'll figure something out. But right now, we need to figure out how to format changes so people know where to copy-and-paste code into the existing system, and also alter database tables.
Simplicio: Aren't there already several available diff formats for that, which already have tools available to create and apply changes automatically? And we can just throw the database alterations into their own SQL script files.
Montesquieu: Sure, but none of that stuff was invented here, so we need to make our own format. And this is the early 2000s, so we need to make it XML because XML is the future and stuff.
Simplicio: So who is going to create the tools to apply these updates automatically?
Montesquieu: I have no idea, but those tools will probably be broken and useless for several years to come.
Simplicio: Good, looks like we have all the bases covered.<|eost|><|sor|>Oh, the reality is even worse. The MODX format was an XMLization of an existing text-based format. The original format was already bad (it was basically a plain-English diff file), but there were at least tools that worked with it. The XML was a gratuitous addition around the release of phpBB 3.
Possibly the worst part of the phpBB mod situation is that the presence of mods often makes it impossible to cleanly upgrade the software. A lot of forum admins deal with this by ignoring upgrades. :(<|eor|><|soopr|>I thought I had remembered doing this with a text-based file, but it was a while ago so I didn't want to add in any unverifiable facts. The verifiable ones are damning enough.
From their sample MODX file:
<edit>
<find>text to find</find>
<action type="after-add">text to be added on the line after</action>
</edit>
I can't say that I've studied diff algorithms in any depth, but I can guess that they didn't, either.<|eoopr|><|eoss|><|endoftext|> | 6 |
lolphp | frezik | c9qnv6x | <|soss|><|sot|>How the phpBB MODX format must have been made<|eot|><|sost|>Another example of fractal badness, where an original bad decision somewhere causes further bad decisions to work around the problems encountered, leading to yet more bad decisions, etc.
The MODX format is used by phpBB for extending the system. Many years ago, I had the misfortune to try to setup a phpBB with a few extensions, and quickly found out that the devs had no idea what they were doing.
----
Montesquieu: Guise! Our poorly-conceived, bug-ridden, security-flawed BB system is taking over the world, but people want to extend it to be even more bug-ridden and security-flawed.
Simplicio: OK, that's normally done by a module system with carefully thought out hooks. Does PHP support any such thing?
Montesquieu: No, and I don't see why it should, and we didn't build it like that in the first place.
Simplicio: Right, so mods are going to have to write code directly into the existing source files. Is there a way to keep different tools from stepping on each other?
Montesquieu: I'm sure we'll figure something out. But right now, we need to figure out how to format changes so people know where to copy-and-paste code into the existing system, and also alter database tables.
Simplicio: Aren't there already several available diff formats for that, which already have tools available to create and apply changes automatically? And we can just throw the database alterations into their own SQL script files.
Montesquieu: Sure, but none of that stuff was invented here, so we need to make our own format. And this is the early 2000s, so we need to make it XML because XML is the future and stuff.
Simplicio: So who is going to create the tools to apply these updates automatically?
Montesquieu: I have no idea, but those tools will probably be broken and useless for several years to come.
Simplicio: Good, looks like we have all the bases covered.<|eost|><|sor|>This is lolphpbb, not lolphp
people have implemented atrocities like this in every language.<|eor|><|soopr|>It's a particularly popular PHP app, and the original problems stem from the lack of modularity in the language.<|eoopr|><|eoss|><|endoftext|> | 6 |
lolphp | duskwuff | c9qic3n | <|soss|><|sot|>How the phpBB MODX format must have been made<|eot|><|sost|>Another example of fractal badness, where an original bad decision somewhere causes further bad decisions to work around the problems encountered, leading to yet more bad decisions, etc.
The MODX format is used by phpBB for extending the system. Many years ago, I had the misfortune to try to setup a phpBB with a few extensions, and quickly found out that the devs had no idea what they were doing.
----
Montesquieu: Guise! Our poorly-conceived, bug-ridden, security-flawed BB system is taking over the world, but people want to extend it to be even more bug-ridden and security-flawed.
Simplicio: OK, that's normally done by a module system with carefully thought out hooks. Does PHP support any such thing?
Montesquieu: No, and I don't see why it should, and we didn't build it like that in the first place.
Simplicio: Right, so mods are going to have to write code directly into the existing source files. Is there a way to keep different tools from stepping on each other?
Montesquieu: I'm sure we'll figure something out. But right now, we need to figure out how to format changes so people know where to copy-and-paste code into the existing system, and also alter database tables.
Simplicio: Aren't there already several available diff formats for that, which already have tools available to create and apply changes automatically? And we can just throw the database alterations into their own SQL script files.
Montesquieu: Sure, but none of that stuff was invented here, so we need to make our own format. And this is the early 2000s, so we need to make it XML because XML is the future and stuff.
Simplicio: So who is going to create the tools to apply these updates automatically?
Montesquieu: I have no idea, but those tools will probably be broken and useless for several years to come.
Simplicio: Good, looks like we have all the bases covered.<|eost|><|sor|>Oh, the reality is even worse. The MODX format was an XMLization of an existing text-based format. The original format was already bad (it was basically a plain-English diff file), but there were at least tools that worked with it. The XML was a gratuitous addition around the release of phpBB 3.
Possibly the worst part of the phpBB mod situation is that the presence of mods often makes it impossible to cleanly upgrade the software. A lot of forum admins deal with this by ignoring upgrades. :(<|eor|><|soopr|>I thought I had remembered doing this with a text-based file, but it was a while ago so I didn't want to add in any unverifiable facts. The verifiable ones are damning enough.
From their sample MODX file:
<edit>
<find>text to find</find>
<action type="after-add">text to be added on the line after</action>
</edit>
I can't say that I've studied diff algorithms in any depth, but I can guess that they didn't, either.<|eoopr|><|sor|>Here's a sample of a phpBB 2.x mod:
http://pastebin.com/bM692g5v
The XML schema is directly derived from this format.<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | bugybunny | 19zhuv | <|sols|><|sot|>This awesome yet simple and pragmatic PHP library performs an addition of two numbers (xpost r/programming)<|eot|><|sol|>https://github.com/Herzult/SimplePHPEasyPlus<|eol|><|eols|><|endoftext|> | 28 |
lolphp | merreborn | c8sujz4 | <|sols|><|sot|>This awesome yet simple and pragmatic PHP library performs an addition of two numbers (xpost r/programming)<|eot|><|sol|>https://github.com/Herzult/SimplePHPEasyPlus<|eol|><|sor|>This should look pretty familiar to java developers<|eor|><|eols|><|endoftext|> | 21 |
lolphp | french_toste | c8suov7 | <|sols|><|sot|>This awesome yet simple and pragmatic PHP library performs an addition of two numbers (xpost r/programming)<|eot|><|sol|>https://github.com/Herzult/SimplePHPEasyPlus<|eol|><|sor|>I dunno, without an AbstractSingletonProxyFactoryBean class I don't think I can use this for my Enterprise XML UX stories.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | polish_niceguy | c8sqd35 | <|sols|><|sot|>This awesome yet simple and pragmatic PHP library performs an addition of two numbers (xpost r/programming)<|eot|><|sol|>https://github.com/Herzult/SimplePHPEasyPlus<|eol|><|sor|>Damn, it took me at least five minutes to find the actual adding code. And it's done with array_sum(). Awesome.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | kingguru | c8u4ny8 | <|sols|><|sot|>This awesome yet simple and pragmatic PHP library performs an addition of two numbers (xpost r/programming)<|eot|><|sol|>https://github.com/Herzult/SimplePHPEasyPlus<|eol|><|sor|>I dunno, without an AbstractSingletonProxyFactoryBean class I don't think I can use this for my Enterprise XML UX stories.<|eor|><|sor|>This actually [exists](http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html) in case someone was wondering.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | davvblack | c9rsp6y | <|sols|><|sot|>This awesome yet simple and pragmatic PHP library performs an addition of two numbers (xpost r/programming)<|eot|><|sol|>https://github.com/Herzult/SimplePHPEasyPlus<|eol|><|sor|>This should look pretty familiar to java developers<|eor|><|sor|>I don't see any FactoryFactorys though.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | vytah | 18nra2 | <|sols|><|sot|>Indexing nulls gives no errors and no warnings<|eot|><|sol|>https://bugs.php.net/bug.php?id=64194<|eol|><|eols|><|endoftext|> | 35 |
lolphp | postmodest | c8gq96f | <|sols|><|sot|>Indexing nulls gives no errors and no warnings<|eot|><|sol|>https://bugs.php.net/bug.php?id=64194<|eol|><|soopr|> $ php -r 'error_reporting(E_ALL | E_STRICT); $a=null; var_dump($a["a"]);'
NULL
It's the same for PHP 5.3 and 5.4, both numeric and string indexes.
Also:
$ php -r 'error_reporting(E_ALL | E_STRICT);$a=null; $a[1]=1; var_dump($a);'
array(1) {
[1]=>
int(1)
}
<|eoopr|><|sor|>The latter is arguably useful. If you're ignorant about proper software development, that is.<|eor|><|sor|>I was going to say "I expect this to be closed as WORKS AS EXPECTED any minute now."<|eor|><|eols|><|endoftext|> | 7 |
lolphp | huf | c8gnfm4 | <|sols|><|sot|>Indexing nulls gives no errors and no warnings<|eot|><|sol|>https://bugs.php.net/bug.php?id=64194<|eol|><|soopr|> $ php -r 'error_reporting(E_ALL | E_STRICT); $a=null; var_dump($a["a"]);'
NULL
It's the same for PHP 5.3 and 5.4, both numeric and string indexes.
Also:
$ php -r 'error_reporting(E_ALL | E_STRICT);$a=null; $a[1]=1; var_dump($a);'
array(1) {
[1]=>
int(1)
}
<|eoopr|><|sor|>The latter is arguably useful. If you're ignorant about proper software development, that is.<|eor|><|sor|>autovivification is a good thing, php has just failed to implement it in a useful and consistent manner. no surprise there :)<|eor|><|eols|><|endoftext|> | 5 |
lolphp | adrenal8 | rscpj | <|sols|><|sot|>PHP's unicode support is basically like playing minesweeper where all the string functions are bombs<|eot|><|sol|>http://www.phpwact.org/php/i18n/utf-8<|eol|><|eols|><|endoftext|> | 35 |
lolphp | Rhomboid | c48ivdh | <|sols|><|sot|>PHP's unicode support is basically like playing minesweeper where all the string functions are bombs<|eot|><|sol|>http://www.phpwact.org/php/i18n/utf-8<|eol|><|sor|>It's not just PHP. Bolting UTF onto 8 bit OSes is a fucking mess.<|eor|><|sor|>It's a good thing that modern OSes are all at least 32-bit, and even MS-DOS was 16-bit. Which 8bit OSes with unicode support are you referring to?<|eor|><|sor|>Are you being serious ?
Hard to tell in PHP forums.
<|eor|><|sor|>You tell us -- you were the one that brought up this "8 bit OS" nonsense in the first place.
Perhaps by "8 bit OS" you mean platforms that declined to jump on the UCS-2 bandwagon. Well guess what, the UCS-2 camp has their own "fucking mess" in that UTF-16 is still a variable length encoding. Even if you chose to use UTF-32, you'd still have to deal with combining characters. The free lunch is over -- Unicode is hard and you don't get to just say that characters are 2 bytes and that's that.
In that light, UTF-8 is the least braindead of all options. It is variable width, yes, but so is everything else. UTF-8 at least doesn't require you to rewrite all of your system APIs and standard libraries, and it doesn't make you play guessing games with big or little endian, and legacy ASCII protocols can be retrofitted to use it.
<|eor|><|eols|><|endoftext|> | 11 |
lolphp | Rhomboid | c48sm90 | <|sols|><|sot|>PHP's unicode support is basically like playing minesweeper where all the string functions are bombs<|eot|><|sol|>http://www.phpwact.org/php/i18n/utf-8<|eol|><|sor|>Are you being serious ?
Hard to tell in PHP forums.
<|eor|><|sor|>You tell us -- you were the one that brought up this "8 bit OS" nonsense in the first place.
Perhaps by "8 bit OS" you mean platforms that declined to jump on the UCS-2 bandwagon. Well guess what, the UCS-2 camp has their own "fucking mess" in that UTF-16 is still a variable length encoding. Even if you chose to use UTF-32, you'd still have to deal with combining characters. The free lunch is over -- Unicode is hard and you don't get to just say that characters are 2 bytes and that's that.
In that light, UTF-8 is the least braindead of all options. It is variable width, yes, but so is everything else. UTF-8 at least doesn't require you to rewrite all of your system APIs and standard libraries, and it doesn't make you play guessing games with big or little endian, and legacy ASCII protocols can be retrofitted to use it.
<|eor|><|sor|>Someone is confusing the word size of the CPU with the text encoding of the OS.
What I actually meant was that the only OS to get it right was the one that [introduced UTF](http://plan9.bell-labs.com/sys/doc/utf.html), namely "Plan 9 From Bell Labs". The Lunix systems could have done the same along time ago but the chose not to, instead chose to lose by using wchar and LOCALE.
<|eor|><|sor|>Linux most certainly did not choose wchar_t. Please name any Linux or BSD syscall that takes wchar_t. You can't, because they don't exist. As far as the kernel is concerned, filenames are null terminated strings and that's it; it's completely encoding agnostic. And any modern Linux distro of the last 5 years will come configured out of the box with a locale that uses UTF-8, and UTF-8 is the de facto standard on all such systems. Nobody uses wchar_t on POSIX systems, as sizeof(wchar_t) is 4 there and not 2 as on Win32 and so it's extremely wasteful. They might use UTF-16 if they're forced to out of compatibility concerns (e.g. a codebase that has to support Windows) or because a specification mandates it (e.g. the JRE.) But nobody that sets out to write POSIX-specific code would ever use anything but UTF-8.
<|eor|><|sor|>That must be why UTF works so well everywhere.<|eor|><|sor|>UTF-8 works quite well on Linux. Tools like grep have been UTF-8 aware for years, and scripting languages that choose to support it such as Perl and Python are widely available. GUI apps written with modern toolkits like gtk+2 and Qt are all perfectly fine with UTF-8. gnome-terminal is fully UTF-8 capable. Where it doesn't work, it's due to the choice of the program's maintainers to not put in the effort, as with PHP.
<|eor|><|sor|>http://savannah.gnu.org/bugs/?29391
too lazy to find more examples<|eor|><|sor|>What on Earth has that got to do with anything? Unicode case folding is much more complex than flipping a single bit as with ASCII, so of course it's going to be slower. You have to use the full Unicode character properties database because each language has its own special rules and idiosyncrasies. That's what you get when you decide to support Unicode.
<|eor|><|eols|><|endoftext|> | 7 |
lolphp | ThisIsADogHello | c48fgfa | <|sols|><|sot|>PHP's unicode support is basically like playing minesweeper where all the string functions are bombs<|eot|><|sol|>http://www.phpwact.org/php/i18n/utf-8<|eol|><|sor|>It's not just PHP. Bolting UTF onto 8 bit OSes is a fucking mess.<|eor|><|sor|>It's a good thing that modern OSes are all at least 32-bit, and even MS-DOS was 16-bit. Which 8bit OSes with unicode support are you referring to?<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Rhomboid | c48sddj | <|sols|><|sot|>PHP's unicode support is basically like playing minesweeper where all the string functions are bombs<|eot|><|sol|>http://www.phpwact.org/php/i18n/utf-8<|eol|><|sor|>It's not just PHP. Bolting UTF onto 8 bit OSes is a fucking mess.<|eor|><|sor|>It's a good thing that modern OSes are all at least 32-bit, and even MS-DOS was 16-bit. Which 8bit OSes with unicode support are you referring to?<|eor|><|sor|>Are you being serious ?
Hard to tell in PHP forums.
<|eor|><|sor|>You tell us -- you were the one that brought up this "8 bit OS" nonsense in the first place.
Perhaps by "8 bit OS" you mean platforms that declined to jump on the UCS-2 bandwagon. Well guess what, the UCS-2 camp has their own "fucking mess" in that UTF-16 is still a variable length encoding. Even if you chose to use UTF-32, you'd still have to deal with combining characters. The free lunch is over -- Unicode is hard and you don't get to just say that characters are 2 bytes and that's that.
In that light, UTF-8 is the least braindead of all options. It is variable width, yes, but so is everything else. UTF-8 at least doesn't require you to rewrite all of your system APIs and standard libraries, and it doesn't make you play guessing games with big or little endian, and legacy ASCII protocols can be retrofitted to use it.
<|eor|><|sor|>Someone is confusing the word size of the CPU with the text encoding of the OS.
What I actually meant was that the only OS to get it right was the one that [introduced UTF](http://plan9.bell-labs.com/sys/doc/utf.html), namely "Plan 9 From Bell Labs". The Lunix systems could have done the same along time ago but the chose not to, instead chose to lose by using wchar and LOCALE.
<|eor|><|sor|>Linux most certainly did not choose wchar_t. Please name any Linux or BSD syscall that takes wchar_t. You can't, because they don't exist. As far as the kernel is concerned, filenames are null terminated strings and that's it; it's completely encoding agnostic. And any modern Linux distro of the last 5 years will come configured out of the box with a locale that uses UTF-8, and UTF-8 is the de facto standard on all such systems. Nobody uses wchar_t on POSIX systems, as sizeof(wchar_t) is 4 there and not 2 as on Win32 and so it's extremely wasteful. They might use UTF-16 if they're forced to out of compatibility concerns (e.g. a codebase that has to support Windows) or because a specification mandates it (e.g. the JRE.) But nobody that sets out to write POSIX-specific code would ever use anything but UTF-8.
<|eor|><|sor|>That must be why UTF works so well everywhere.<|eor|><|sor|>UTF-8 works quite well on Linux. Tools like grep have been UTF-8 aware for years, and scripting languages that choose to support it such as Perl and Python are widely available. GUI apps written with modern toolkits like gtk+2 and Qt are all perfectly fine with UTF-8. gnome-terminal is fully UTF-8 capable. Where it doesn't work, it's due to the choice of the program's maintainers to not put in the effort, as with PHP.
<|eor|><|eols|><|endoftext|> | 5 |
lolphp | iheartrms | fjlr3e | <|sols|><|sot|>The report notes, however, that "PHPs relative number of vulnerabilities has risen significantly, while theres no indication of the same rise in popularity."<|eot|><|sol|>https://www.theregister.co.uk/2020/03/13/open_source_bugs/<|eol|><|eols|><|endoftext|> | 31 |
lolphp | colshrapnel | fkno2py | <|sols|><|sot|>The report notes, however, that "PHPs relative number of vulnerabilities has risen significantly, while theres no indication of the same rise in popularity."<|eot|><|sol|>https://www.theregister.co.uk/2020/03/13/open_source_bugs/<|eol|><|sor|>Theregister refers to whitesource, whitesource (wtf is whitesource?) refers to its report and there are no sources in the report. That's what I call a quality research.
And of course XSS in some noob's app is a lolphp.<|eor|><|eols|><|endoftext|> | 40 |
lolphp | CarnivorousSociety | fknobbn | <|sols|><|sot|>The report notes, however, that "PHPs relative number of vulnerabilities has risen significantly, while theres no indication of the same rise in popularity."<|eot|><|sol|>https://www.theregister.co.uk/2020/03/13/open_source_bugs/<|eol|><|sor|>Hasn't the number of people looking for them gone up? And the number of people developing for PHP even? So more code being committed on a regular basis?<|eor|><|eols|><|endoftext|> | 8 |
lolphp | bart2019 | fkps5vl | <|sols|><|sot|>The report notes, however, that "PHPs relative number of vulnerabilities has risen significantly, while theres no indication of the same rise in popularity."<|eot|><|sol|>https://www.theregister.co.uk/2020/03/13/open_source_bugs/<|eol|><|sor|>Hasn't the number of people looking for them gone up? And the number of people developing for PHP even? So more code being committed on a regular basis?<|eor|><|sor|>Haven't you even glanced at the article? That's even in the title.
>#Open-source bug bonanza: Vulnerabilities up almost 50 per cent thanks to people actually looking for them
>##Can't fix flaws if you don't look for them<|eor|><|eols|><|endoftext|> | 7 |
lolphp | supermario182 | fkqy5e0 | <|sols|><|sot|>The report notes, however, that "PHPs relative number of vulnerabilities has risen significantly, while theres no indication of the same rise in popularity."<|eot|><|sol|>https://www.theregister.co.uk/2020/03/13/open_source_bugs/<|eol|><|sor|>Php started Corina virus<|eor|><|eols|><|endoftext|> | 5 |
lolphp | koebelin | fkqkusy | <|sols|><|sot|>The report notes, however, that "PHPs relative number of vulnerabilities has risen significantly, while theres no indication of the same rise in popularity."<|eot|><|sol|>https://www.theregister.co.uk/2020/03/13/open_source_bugs/<|eol|><|sor|>PHP is in a downward spiral, its out of the top10 soon. I think it went the way of Perl because of bad management. There was so much bad design and weird behaviour and none of ot was fixed. Now years laters ots just unusable, and requires huge frameworks to be tolerable. Also its slow and clunky and is stuck in the old cgi mindset. Its just a mess from top to bottom.<|eor|><|sor|>It's your 2002 RAV-4 that still gets you to work and home every day even though you're being passed on the highway by hot new models.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | FormerPHPDeveloper | beaxm2 | <|soss|><|sot|>Short closures are being voted!<|eot|><|sost|>What people wanted:
1. Real lexical scope (that is, like in ES)
2. Nice enough syntax
​
What people are getting:
\- No lexical scope, variables are imported by value
\- Of all the possibilities mentioned in the RFC the most god awful syntax is being put to vote: fn () =>
LITERALLY. EVERY. ONE. OF. THE. OTHER. PROPOSED. SYNTAXES. WAS. BETTER. THAN. THAT.
No multi-expression support
​
People can $map->reduce() the shit out of everything with cool one liners!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Like, if they ever needed to!!!!!!!!!!!
​
The rest of us, will still have to deal with the function () use ( ) { } shit.
​
Seriously, there is no hope. PHP is so disconnected from reality that it's not even fun making fun of it anymore.
​
[https://wiki.php.net/rfc/arrow\_functions\_v2](https://wiki.php.net/rfc/arrow_functions_v2)<|eost|><|eoss|><|endoftext|> | 28 |
lolphp | the_alias_of_andrea | el5epat | <|soss|><|sot|>Short closures are being voted!<|eot|><|sost|>What people wanted:
1. Real lexical scope (that is, like in ES)
2. Nice enough syntax
​
What people are getting:
\- No lexical scope, variables are imported by value
\- Of all the possibilities mentioned in the RFC the most god awful syntax is being put to vote: fn () =>
LITERALLY. EVERY. ONE. OF. THE. OTHER. PROPOSED. SYNTAXES. WAS. BETTER. THAN. THAT.
No multi-expression support
​
People can $map->reduce() the shit out of everything with cool one liners!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Like, if they ever needed to!!!!!!!!!!!
​
The rest of us, will still have to deal with the function () use ( ) { } shit.
​
Seriously, there is no hope. PHP is so disconnected from reality that it's not even fun making fun of it anymore.
​
[https://wiki.php.net/rfc/arrow\_functions\_v2](https://wiki.php.net/rfc/arrow_functions_v2)<|eost|><|sor|>JavaScript keeping the scope alive after the function invocation can be a bit of a footgun, and copying the values is fine for a single expression anyway, you surely aren't modifying anything there.<|eor|><|eoss|><|endoftext|> | 11 |
lolphp | FormerPHPDeveloper | el5aacb | <|soss|><|sot|>Short closures are being voted!<|eot|><|sost|>What people wanted:
1. Real lexical scope (that is, like in ES)
2. Nice enough syntax
​
What people are getting:
\- No lexical scope, variables are imported by value
\- Of all the possibilities mentioned in the RFC the most god awful syntax is being put to vote: fn () =>
LITERALLY. EVERY. ONE. OF. THE. OTHER. PROPOSED. SYNTAXES. WAS. BETTER. THAN. THAT.
No multi-expression support
​
People can $map->reduce() the shit out of everything with cool one liners!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Like, if they ever needed to!!!!!!!!!!!
​
The rest of us, will still have to deal with the function () use ( ) { } shit.
​
Seriously, there is no hope. PHP is so disconnected from reality that it's not even fun making fun of it anymore.
​
[https://wiki.php.net/rfc/arrow\_functions\_v2](https://wiki.php.net/rfc/arrow_functions_v2)<|eost|><|soopr|>The problem is that PHP developers never wanted to pull their head out of the 30 years old hole they themselves dug to see what others were doing<|eoopr|><|sor|>Im waiting to see everything youve contributed to the core language.<|eor|><|soopr|>I've been contributing to one of the leading PHP frameworks for more than 10 years.
I tried contributing to the core, but as I said, their head is really jammed in that hole.<|eoopr|><|eoss|><|endoftext|> | 9 |
lolphp | barubary | el77cdz | <|soss|><|sot|>Short closures are being voted!<|eot|><|sost|>What people wanted:
1. Real lexical scope (that is, like in ES)
2. Nice enough syntax
​
What people are getting:
\- No lexical scope, variables are imported by value
\- Of all the possibilities mentioned in the RFC the most god awful syntax is being put to vote: fn () =>
LITERALLY. EVERY. ONE. OF. THE. OTHER. PROPOSED. SYNTAXES. WAS. BETTER. THAN. THAT.
No multi-expression support
​
People can $map->reduce() the shit out of everything with cool one liners!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Like, if they ever needed to!!!!!!!!!!!
​
The rest of us, will still have to deal with the function () use ( ) { } shit.
​
Seriously, there is no hope. PHP is so disconnected from reality that it's not even fun making fun of it anymore.
​
[https://wiki.php.net/rfc/arrow\_functions\_v2](https://wiki.php.net/rfc/arrow_functions_v2)<|eost|><|sor|>JavaScript keeping the scope alive after the function invocation can be a bit of a footgun, and copying the values is fine for a single expression anyway, you surely aren't modifying anything there.<|eor|><|sor|>It doesn't really have to keep the whole scope alive, just the (usually few) variables that nested functions close over. At least that's how it is in strict mode. I believe non-strict mode makes this optimization impossible due to `eval` shenanigans.
As for copying and single expressions, consider [this example](https://tio.run/##bY1bDoIwEEX/u4oJMaEkygIkuBWpZTDV2pppyyOEtdcqxg91/ubcuXMuohdOkrr7nbEtxpgHh@A8KenzirEuGOmVNXATVzwSdkhoJPKxgJlBGkIfyLyXFYh2D7yA@gDj9oMHUh4Tn9YAapjWcKnYwphGD5TglybrrM2KiklrnNVYanvmjdUt9EKH9G4zU/kU8mJp0hmVLw3PToJ@agaH/7UYHw):
'use strict';
function make_reference(x) {
return {
read: () => x,
write: (y) => x = y,
};
}
let r = make_reference("foo");
console.log(`old value: ${r.read()}`);
r.write("bar");
console.log(`new value: ${r.read()}`);
It creates a reference to a value, allowing indirect modification. (Copying the reference doesn't copy the value it refers to.) It is built out of a pair of single-expression closures.
You might argue that `write` is bad style, abusing the fact that assignment is an operator in JS and we should write `(y) => { x = y; }` instead. Fair enough. But even so, `read` is a perfectly harmless function without side effects, and yet it wouldn't work if `x` were imported by value. Non-copying semantics are crucial here because we rely on the closure being able to see modifications made elsewhere. The modification doesn't have to be inside the closure.<|eor|><|eoss|><|endoftext|> | 8 |
lolphp | infinull | el54lrd | <|soss|><|sot|>Short closures are being voted!<|eot|><|sost|>What people wanted:
1. Real lexical scope (that is, like in ES)
2. Nice enough syntax
​
What people are getting:
\- No lexical scope, variables are imported by value
\- Of all the possibilities mentioned in the RFC the most god awful syntax is being put to vote: fn () =>
LITERALLY. EVERY. ONE. OF. THE. OTHER. PROPOSED. SYNTAXES. WAS. BETTER. THAN. THAT.
No multi-expression support
​
People can $map->reduce() the shit out of everything with cool one liners!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Like, if they ever needed to!!!!!!!!!!!
​
The rest of us, will still have to deal with the function () use ( ) { } shit.
​
Seriously, there is no hope. PHP is so disconnected from reality that it's not even fun making fun of it anymore.
​
[https://wiki.php.net/rfc/arrow\_functions\_v2](https://wiki.php.net/rfc/arrow_functions_v2)<|eost|><|sor|>I don't hate the new syntax... and I think several of the syntax's in the proposal are worse (like `[\T &$x => $y]` is... the worst) but no lexical scoping... that's... like I have no words for how dumb that is.<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | Takeoded | 9hf1yy | <|sols|><|sot|>base_convert: invalid characters are silently ignored, because, y'know, an error would be inconvenient.<|eot|><|sol|>https://secure.php.net/manual/en/function.base-convert.php<|eol|><|eols|><|endoftext|> | 29 |
lolphp | yawkat | e6bxv0z | <|sols|><|sot|>base_convert: invalid characters are silently ignored, because, y'know, an error would be inconvenient.<|eot|><|sol|>https://secure.php.net/manual/en/function.base-convert.php<|eol|><|sor|>[deleted]<|eor|><|sor|>You shouldn't design your method around every possible use case. An error would have been more sensible - a user can always strip characters they don't want beforehand.<|eor|><|eols|><|endoftext|> | 16 |
lolphp | shitcanz | 8k1dt5 | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|eols|><|endoftext|> | 32 |
lolphp | CornPlanter | dz4rmxg | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>It drives me mad every time I think about it... as a self tought programmer, 15 years ago I started learning programming from PHP and I used to think it's normal. When I eventually decided to broaden my horizons and learn C# a couple years later, it looked very weird to me that they had namespaces and the requirement for "using" statements looked so wtf at first.
If you don't know programming never start learning it from PHP. It's gonna give you such a disturbed idea of "normal" you gonna find it hard to adapt in a real normal world of programming later.
Ofc people like that probably don't read this forum but just in a case. Never start with PHP even if later on the road PHP may be useful for certain tasks or requried for certain jobs.<|eor|><|eols|><|endoftext|> | 25 |
lolphp | Dereleased | dz4gfy3 | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>Did you just start using PHP a week ago?<|eor|><|eols|><|endoftext|> | 20 |
lolphp | barubary | dz4lcm1 | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>But some of the functions on that page *are* namespaced. For example, *Ds*, *MongoDB*, *pht* and *Swoole* are top-level namespaces. Are you stupid?<|eor|><|sor|>Raw number of entries on that page: 4744
Number of global functions (i.e. names not containing `::` or `\`): 4683
Specifically:
Number of namespaced functions (names containing `\`): 17
Number of methods (names containing `::`): 44
---
If you have more than *four thousand* names in the global namespace (case insensitive to boot), does it really make a difference if 17 of the functions are namespaced?
> Are you stupid?<|eor|><|eols|><|endoftext|> | 20 |
lolphp | barubary | dz6d7d3 | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>I guess the biggest lol in this mess is that PHP had the chance to actually fix this issue back when 5.3 was released. With the introduction of namespaces PHP could have reserved a set of core namespaces for a new stdlib. And then start slowly deprecating all the mess that is PHP today. And as of 7.0 they could have totally deprecate all the old mess.
All this fell on deaf ears, instead the introduced goto and added more mess to the global namespace.<|eor|><|sor|>Personally I think an even bigger lol/cry is that PHP was heavily influenced by Perl, but seemingly without understanding the design decisions behind Perl.
In particular:
- 1989: Release of Perl 3. Perl 3 already supports namespaces.
- 1991: Release of Perl 4. Namespace support is still there. Some of the user-supplied Perl libraries (`.pl` files) shipped with Perl 4 use them, e.g. `chat2.pl` (remote communication over sockets) has everything in `chat::`, `newgetopt.pl` (command line option parsing) has configuration variables in `newgetopt::`.
- 1994: Release of Perl 5. First version to support `use` statements and Perl modules (`.pm` files), `strict` mode (detects undeclared/typo'd variable names at compile time), OO (classes, methods, and inheritance), closures, and many more features. Modules now use namespaces as a matter of course. One of the modules is a common database interface (DBI) with backends for various RDBMS (e.g. Oracle), letting you switch out your database with relative ease. (I'm not sure when DBI development started; the earliest release I can find is DBI 0.58 from 1995.)
- 1995: Release of PHP 1.
- 1997: Release of PHP 2. The language is very much "organically grown" at this point. It has many superficial similarities with Perl.
- 1998: Release of PHP 3, featuring a rewritten parser.
- 2000: Release of PHP 4. Overhauled core ("Zend engine").
- 2002: Release of Perl 5.8. Among other things, it includes fully integrated Unicode support (strings are now sequences of codepoints and not limited to single bytes).
- 2004: Release of PHP 5. Another core overhaul ("Zend engine 2"). It includes real OO support and a common database interface (PDO).
- 2009: Release of PHP 5.3. Supports namespaces and closures. At this point the language has about 2000 built-in identifiers/keywords in the global namespace.
As of today, PHP still does not have Unicode strings.
If they had wanted to, they could have implemented namespaces at any point with the release of PHP 3, PHP 4, or PHP 5. The concept was out there and fully supported by PHP's direct inspiration and competitor during the late 90s / early 2000s CGI era, Perl.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | coredumperror | dz5if7e | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>Did you just start using PHP a week ago?<|eor|><|sor|>Just because its something you learn to accept about PHP with use doesnt mean its not terrible language design.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | shitcanz | dz6dd3m | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>Did you just start using PHP a week ago?<|eor|><|sor|>Just because its something you learn to accept about PHP with use doesnt mean its not terrible language design.<|eor|><|sor|>Right, but is it really a lolphp anymore?<|eor|><|soopr|>\> lolphp anymore?
Well ofc. it is. Its a lolphp as long as its not fixed.<|eoopr|><|eols|><|endoftext|> | 11 |
lolphp | shitcanz | dz6f3os | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>Did you just start using PHP a week ago?<|eor|><|sor|>Just because its something you learn to accept about PHP with use doesnt mean its not terrible language design.<|eor|><|sor|>Right, but is it really a lolphp anymore?<|eor|><|soopr|>\> lolphp anymore?
Well ofc. it is. Its a lolphp as long as its not fixed.<|eoopr|><|sor|>When are you fixing it?<|eor|><|soopr|>I actually tried to voice my concern about everything global back many many years ago. The answer i got was pretty much "meh" and wontfix. The golden opportunity was when namespaces came, that single addition to 5.3 could have made PHP a even sane language by now. Instead they chose to add more stuff to the globals. PHP even has superglobals, its a lol by itself.<|eoopr|><|sor|>Wow, you "voiced your concern." What a great contribution you've made. Far be it for you to actually submit a draft proposal that namespaces everything according to your ideals, let alone a PR, but by all means you've earned the right to whine about it on Reddit like a little bitch.<|eor|><|soopr|>Why would i ever write code for something that will never get accepted? That said i would never be a PHP contributor, as i have seen how mad the PHP internals is. Have a look here: [https://blog.ircmaxell.com/2013/09/rambling\-on\-internals.html](https://blog.ircmaxell.com/2013/09/rambling-on-internals.html)
There was a discussion going around over a new namespaced stdlib, but as you know it did not get accepted. Im not sure they had a RFC process back then, its so many years ago.<|eoopr|><|eols|><|endoftext|> | 11 |
lolphp | shitcanz | dz6dyfx | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>Did you just start using PHP a week ago?<|eor|><|sor|>Just because its something you learn to accept about PHP with use doesnt mean its not terrible language design.<|eor|><|sor|>Right, but is it really a lolphp anymore?<|eor|><|soopr|>\> lolphp anymore?
Well ofc. it is. Its a lolphp as long as its not fixed.<|eoopr|><|sor|>When are you fixing it?<|eor|><|soopr|>I actually tried to voice my concern about everything global back many many years ago. The answer i got was pretty much "meh" and wontfix. The golden opportunity was when namespaces came, that single addition to 5.3 could have made PHP a even sane language by now. Instead they chose to add more stuff to the globals. PHP even has superglobals, its a lol by itself.<|eoopr|><|eols|><|endoftext|> | 8 |
lolphp | carlos_vini | dz6s0dl | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>I guess the biggest lol in this mess is that PHP had the chance to actually fix this issue back when 5.3 was released. With the introduction of namespaces PHP could have reserved a set of core namespaces for a new stdlib. And then start slowly deprecating all the mess that is PHP today. And as of 7.0 they could have totally deprecate all the old mess.
All this fell on deaf ears, instead the introduced goto and added more mess to the global namespace.<|eor|><|sor|>Personally I think an even bigger lol/cry is that PHP was heavily influenced by Perl, but seemingly without understanding the design decisions behind Perl.
In particular:
- 1989: Release of Perl 3. Perl 3 already supports namespaces.
- 1991: Release of Perl 4. Namespace support is still there. Some of the user-supplied Perl libraries (`.pl` files) shipped with Perl 4 use them, e.g. `chat2.pl` (remote communication over sockets) has everything in `chat::`, `newgetopt.pl` (command line option parsing) has configuration variables in `newgetopt::`.
- 1994: Release of Perl 5. First version to support `use` statements and Perl modules (`.pm` files), `strict` mode (detects undeclared/typo'd variable names at compile time), OO (classes, methods, and inheritance), closures, and many more features. Modules now use namespaces as a matter of course. One of the modules is a common database interface (DBI) with backends for various RDBMS (e.g. Oracle), letting you switch out your database with relative ease. (I'm not sure when DBI development started; the earliest release I can find is DBI 0.58 from 1995.)
- 1995: Release of PHP 1.
- 1997: Release of PHP 2. The language is very much "organically grown" at this point. It has many superficial similarities with Perl.
- 1998: Release of PHP 3, featuring a rewritten parser.
- 2000: Release of PHP 4. Overhauled core ("Zend engine").
- 2002: Release of Perl 5.8. Among other things, it includes fully integrated Unicode support (strings are now sequences of codepoints and not limited to single bytes).
- 2004: Release of PHP 5. Another core overhaul ("Zend engine 2"). It includes real OO support and a common database interface (PDO).
- 2009: Release of PHP 5.3. Supports namespaces and closures. At this point the language has about 2000 built-in identifiers/keywords in the global namespace.
As of today, PHP still does not have Unicode strings.
If they had wanted to, they could have implemented namespaces at any point with the release of PHP 3, PHP 4, or PHP 5. The concept was out there and fully supported by PHP's direct inspiration and competitor during the late 90s / early 2000s CGI era, Perl.<|eor|><|sor|>we need more of this kind of reply in this page, no free hate \+ interesting facts. The thing is PHP never was intended to be a real language. Many years ago I wrote a transpiler for a subset of SASS in PHP, just using REGEX, XML and some conditionals. I never tested the code, i never intended it to replace SASS, I just wanted to have the niceness of SASS in PHP in a shitty shared hosting that had nothing but PHP running on it. PHP is just like that, it was just a tool for people that would not bother to use a real language but wanted some logic on their HTML. It's beating a dead horse to say PHP was not well designed, because: it really wasn't designed at all. It was temporary and hacky. The fact it survived just proves how hard the other technologies were, if you think about it THEY were not designed to be easy to use.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | cleeder | dz76ov4 | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>This is something I _really_ wish PHP would address, but alas it's not meant to be.
It's not like it would be particularly difficult. It would be a good target for a backwards compatibility break in PHP8. Even still, it would be trivial to ship an upgrade routine that parses a code base and transforms old root scope methods to new namespaced methods with appropriate `use` statements at the top of the file. At the same time, you can fix a lot of inconsistent core function naming/parameters.<|eor|><|sor|>> it would be trivial to ship an upgrade routine that parses a code base and transforms old root scope methods to new namespaced methods with appropriate use statements at the top of the file
Prove it.<|eor|><|sor|>I mean...this is very basic stuff. There's not much to prove. We already have tools which parse, tokenize and modify PHP code bases. PHPCS's "fixers", for example.<|eor|><|sor|>Good thing there are no contexts or edge cases where they cannot operate.<|eor|><|sor|>The only "edge case" I can think of where a transpiler might have issue is with global function calls stored as a callable (e.g. string) and passed around.
In which _rare_ case, yes, you might actually have to do a little bit of work to upgrade to the new major version of PHP. Shocking.
A transpiler would fix 98% of use cases, and the addition an actual properly namespaced core API/library would be worth it that extra 2% of effort when upgrading to a new major version of PHP.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | cleeder | dz57ev1 | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>This is something I _really_ wish PHP would address, but alas it's not meant to be.
It's not like it would be particularly difficult. It would be a good target for a backwards compatibility break in PHP8. Even still, it would be trivial to ship an upgrade routine that parses a code base and transforms old root scope methods to new namespaced methods with appropriate `use` statements at the top of the file. At the same time, you can fix a lot of inconsistent core function naming/parameters.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | cleeder | dz75utr | <|sols|><|sot|>Why bother with packages/modules when every function can live in the global namespace?<|eot|><|sol|>http://php.net/manual/en/indexes.functions.php<|eol|><|sor|>This is something I _really_ wish PHP would address, but alas it's not meant to be.
It's not like it would be particularly difficult. It would be a good target for a backwards compatibility break in PHP8. Even still, it would be trivial to ship an upgrade routine that parses a code base and transforms old root scope methods to new namespaced methods with appropriate `use` statements at the top of the file. At the same time, you can fix a lot of inconsistent core function naming/parameters.<|eor|><|sor|>> it would be trivial to ship an upgrade routine that parses a code base and transforms old root scope methods to new namespaced methods with appropriate use statements at the top of the file
Prove it.<|eor|><|sor|>I mean...this is very basic stuff. There's not much to prove. We already have tools which parse, tokenize and modify PHP code bases. PHPCS's "fixers", for example.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | human_bacon | 6qo7ve | <|sols|><|sot|>PHP's probabilistic session management<|eot|><|sol|>http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor<|eol|><|eols|><|endoftext|> | 32 |
lolphp | iglocska | dkzlq0d | <|sols|><|sot|>PHP's probabilistic session management<|eot|><|sol|>http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor<|eol|><|sor|>It's not the session management, just the garbage collection of expired sessions that goes through this. The idea is simple, if you want to run garbage collection (something that is not free) once every x page loads, then you have two options:
- You keep the state of the number of page loads until it reaches a threshold (you really don't want to keep persistence post tear-down of a page render though)
- You simply introduce a requirement that is only met 1/x of the cases. This is exactly what this does, it's cheap and it works for all intents and purposes. <|eor|><|eols|><|endoftext|> | 19 |
lolphp | duskwuff | dkz9ptq | <|sols|><|sot|>PHP's probabilistic session management<|eot|><|sol|>http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor<|eol|><|sor|>...*why*?<|eor|><|soopr|>This is how cron is done in PHP because it doesn't have a long running process, cron jobs will be when there is an incoming request. WordPress has something similar https://codex.wordpress.org/Function_Reference/wp_schedule_event.
But why they make it probabilistic is beyond me.<|eoopr|><|sor|>> But why they make it probabilistic is beyond me.
Making it happen on every request would place an unnecessary load on the server, and making it happen periodically would require some sort of scheduling/locking system.
Doing it probabilistically is actually a pretty reasonable design choice.<|eor|><|eols|><|endoftext|> | 16 |
lolphp | iglocska | dl02f75 | <|sols|><|sot|>PHP's probabilistic session management<|eot|><|sol|>http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor<|eol|><|sor|>It's not the session management, just the garbage collection of expired sessions that goes through this. The idea is simple, if you want to run garbage collection (something that is not free) once every x page loads, then you have two options:
- You keep the state of the number of page loads until it reaches a threshold (you really don't want to keep persistence post tear-down of a page render though)
- You simply introduce a requirement that is only met 1/x of the cases. This is exactly what this does, it's cheap and it works for all intents and purposes. <|eor|><|soopr|>But you can still access the expired session data before the gc runs. That means whether the session exist or not is indeterminstic.<|eoopr|><|sor|>Which is fine, they have an expiration timestamp. <|eor|><|eols|><|endoftext|> | 14 |
lolphp | NickUnrelatedToPost | dkz1w0q | <|sols|><|sot|>PHP's probabilistic session management<|eot|><|sol|>http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor<|eol|><|sor|>...*why*?<|eor|><|soopr|>This is how cron is done in PHP because it doesn't have a long running process, cron jobs will be when there is an incoming request. WordPress has something similar https://codex.wordpress.org/Function_Reference/wp_schedule_event.
But why they make it probabilistic is beyond me.<|eoopr|><|sor|>> But why they make it probabilistic is beyond me.
Maybe because then they don't need a shared variable for a counter. <|eor|><|eols|><|endoftext|> | 14 |
lolphp | Tiquortoo | dkzc174 | <|sols|><|sot|>PHP's probabilistic session management<|eot|><|sol|>http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor<|eol|><|sor|>...*why*?<|eor|><|soopr|>This is how cron is done in PHP because it doesn't have a long running process, cron jobs will be when there is an incoming request. WordPress has something similar https://codex.wordpress.org/Function_Reference/wp_schedule_event.
But why they make it probabilistic is beyond me.<|eoopr|><|sor|>Yeah, it's the probabilisitic part that I just don't get. <|eor|><|sor|>Otherwise they have to save state somewhere. This approach means it will run around as often as you enter. Similar results for much less resources and management.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | SituationSoap | dkyriid | <|sols|><|sot|>PHP's probabilistic session management<|eot|><|sol|>http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor<|eol|><|sor|>...*why*?<|eor|><|eols|><|endoftext|> | 9 |
lolphp | the_alias_of_andrea | 3tqufh | <|sols|><|sot|>The mysteries of properties<|eot|><|sol|>https://3v4l.org/hfUIS<|eol|><|eols|><|endoftext|> | 32 |
lolphp | FlyLo11 | cx9jdlh | <|sols|><|sot|>The mysteries of properties<|eot|><|sol|>https://3v4l.org/hfUIS<|eol|><|sor|>Interestingly enough, property_exists() still returns true after the unset()
https://3v4l.org/h8DUC
I hope this won't lead to a new function real_unset()<|eor|><|eols|><|endoftext|> | 17 |
lolphp | Dylan16807 | cx96swd | <|sols|><|sot|>The mysteries of properties<|eot|><|sol|>https://3v4l.org/hfUIS<|eol|><|sor|>What is the output you were expecting?<|eor|><|sor|>If you add a property with a new name, it's public. But even though the old x was supposedly "destroyed", it's making the new x private.<|eor|><|eols|><|endoftext|> | 12 |
lolphp | ThraShErDDoS | cx97ud2 | <|sols|><|sot|>The mysteries of properties<|eot|><|sol|>https://3v4l.org/hfUIS<|eol|><|sor|>What is the output you were expecting?<|eor|><|sor|>If you add a property with a new name, it's public. But even though the old x was supposedly "destroyed", it's making the new x private.<|eor|><|sor|>I changed it to protected and the final result was a protected int(2). So it's definitely remembering the removed property. Does look like a bug.
Protected: https://3v4l.org/cNnjd
Standard without defining property: https://3v4l.org/pkV8U<|eor|><|eols|><|endoftext|> | 12 |
lolphp | the_alias_of_andrea | cx9a4e3 | <|sols|><|sot|>The mysteries of properties<|eot|><|sol|>https://3v4l.org/hfUIS<|eol|><|sor|>What is the output you were expecting?<|eor|><|sor|>If you add a property with a new name, it's public. But even though the old x was supposedly "destroyed", it's making the new x private.<|eor|><|soopr|>You can understand why the new x is private from an implementation standpoint, but then it begs the question of why you can unset() a defined property anyway.<|eoopr|><|eols|><|endoftext|> | 6 |
lolphp | iheartrms | 30amcf | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|eols|><|endoftext|> | 35 |
lolphp | pilif | cpqtgat | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Our code is full of generators, closures, maps, filters and many other high-order functions. Even though we dislike PHP with a lot of passion, our main product was initially written in 2004 (where PHP was one of the more viable options actually and it certainly was the language I was most proficient with and there was some time pressure) and has since grown to 300K lines of code.
At the point of where we really started seeing the drawbacks and annoyances in PHP, we were already at over 100K lines and at a point where rewriting the whole thing would have been prohibitively expensive to the point of actually risking to kill our company.
As we are splitting the code base into a collection of micro services written in js/node, ruby and clojure, we still have to deal with a huge chunk of PHP over the foreseeable future and if we can shape the language to a usage that matches our taste and sensible expectations of today's languages more, that's even better.
This is why new code is using as functional a style as possible in PHP and this is why I'm grateful for every additional modern language feature we get and for every old legacy that gets cut (scalar type hinting will be HUGE for us).<|eor|><|eols|><|endoftext|> | 21 |
lolphp | tapesmith | cpqvj2s | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Look, I don't like PHP. If it was a choice between getting fired and doing full-time PHP development, I'd polish my rsum.
But isn't this a good thing for the people who are stuck writing PHP and can't avoid it? It's like the more recent improvements to Javascript; ES3 is landmine city, but ES5 is pretty okay and ES6 is gettin' to be an alright thing to use. So sure, the likes of C#, Haskell, or Lisp are better languages, but if you can't *not* write Javascript, it's at least not a bad experience now.
Yes, Javascript's not as bad as PHP, but shouldn't we be happy that those of us who have to endure PHP have *some* niceties?<|eor|><|eols|><|endoftext|> | 20 |
lolphp | smog_alado | cpqx5mv | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>> Anonymous functions reign supreme in JavaScript, and PHP programmers who don't also know JavaScript are rare. So it was natural for PHP to evolve to include anonymous functions
You know things are really fucked up when your programming language has Javascript as a positive role model and a source of inspiration.
> If you're used to working with closures in JavaScript, then you're already familiar with their power, flexibility, and *sometimes dangerous nature*.
I wonder why he thinks closures are somehow inherently dangerous. At worse its a simpler version of OOP with less room for you to shoot yourself on the foot.<|eor|><|eols|><|endoftext|> | 20 |
lolphp | ma-int | cpqtexm | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Wait, I have to declare what variables my function closes over? Shouldn't the PHP compiler be able to....oh...nevermind.<|eor|><|eols|><|endoftext|> | 17 |
lolphp | HiddenKrypt | cpr98cn | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>> Anonymous functions reign supreme in JavaScript, and PHP programmers who don't also know JavaScript are rare. So it was natural for PHP to evolve to include anonymous functions
You know things are really fucked up when your programming language has Javascript as a positive role model and a source of inspiration.
> If you're used to working with closures in JavaScript, then you're already familiar with their power, flexibility, and *sometimes dangerous nature*.
I wonder why he thinks closures are somehow inherently dangerous. At worse its a simpler version of OOP with less room for you to shoot yourself on the foot.<|eor|><|sor|>Javascript is *exactly* the sort of language PHP should have as a role model. Seriously, it's an inspiration. It came from similar roots as PHP (too many cooks, inconsistent design direction) And was (rightly at the time) saddled with a terrible reputation. But it persevered. It changed, and for the better. The "use strict" pragma alone really cleans up the language, and ES6 is a huge change in the direction of a good language design.
Unfortunately, I think you're wrong. PHP isn't using Javascript as an inspiration. Javascript has gotten better largely by attempts to define a [subset of the language](http://i.imgur.com/wR3ZxfB.jpg) worth working with, while carefully introducing new features that mesh well with the existign direction the language has been facing. PHP has been trying to find "The Good Parts" by running out and stealing every little feature they think is missing, all while failing to recognize that it's not what they lack, it's what they *have* that sucks. <|eor|><|eols|><|endoftext|> | 15 |
lolphp | thelordofcheese | cpr88q1 | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Our code is full of generators, closures, maps, filters and many other high-order functions. Even though we dislike PHP with a lot of passion, our main product was initially written in 2004 (where PHP was one of the more viable options actually and it certainly was the language I was most proficient with and there was some time pressure) and has since grown to 300K lines of code.
At the point of where we really started seeing the drawbacks and annoyances in PHP, we were already at over 100K lines and at a point where rewriting the whole thing would have been prohibitively expensive to the point of actually risking to kill our company.
As we are splitting the code base into a collection of micro services written in js/node, ruby and clojure, we still have to deal with a huge chunk of PHP over the foreseeable future and if we can shape the language to a usage that matches our taste and sensible expectations of today's languages more, that's even better.
This is why new code is using as functional a style as possible in PHP and this is why I'm grateful for every additional modern language feature we get and for every old legacy that gets cut (scalar type hinting will be HUGE for us).<|eor|><|sor|>And there we are. I once lived with a guy who was a FORTRAN contractor. He was ancient, and living in boarding houses because he had to move from city to city maintaining ancient code.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | accountforshit | cpr97ig | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Look, I don't like PHP. If it was a choice between getting fired and doing full-time PHP development, I'd polish my rsum.
But isn't this a good thing for the people who are stuck writing PHP and can't avoid it? It's like the more recent improvements to Javascript; ES3 is landmine city, but ES5 is pretty okay and ES6 is gettin' to be an alright thing to use. So sure, the likes of C#, Haskell, or Lisp are better languages, but if you can't *not* write Javascript, it's at least not a bad experience now.
Yes, Javascript's not as bad as PHP, but shouldn't we be happy that those of us who have to endure PHP have *some* niceties?<|eor|><|sor|>JavaScript isn't as bad as PHP because it doesn't try to make kitchen sink soup and isn't engineered by too many cooks.<|eor|><|sor|>On the other hand, the fact that javascript lacks many features results in countless custom implementations in userland. Then every other library has its own coding style and patterns instead of a quasi-standard way of doing things.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | cbraga | cpr1txj | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Closures are great and allow for a lot of versatility in your code?
More retarded arguments from the PHP haters. Literally grasping at straws.<|eor|><|sor|>> Literally grasping at straws.
Literally figuratively.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | barubary | cpralay | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>More importantly, how were namespaces not a thing until >= 5.2? Seriously?<|eor|><|sor|>What makes it even worse IMHO is that PHP's origins lie in a bunch of CGI scripts written in Perl by Rasmus Lerdorf (around 1994) and PHP's syntax was strongly influenced by Perl 4.
Perl has had namespaces since version 3, released in 1989 (and full closures since 1994).<|eor|><|eols|><|endoftext|> | 10 |
lolphp | cparen | cpsueyp | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>More importantly, how were namespaces not a thing until >= 5.2? Seriously?<|eor|><|sor|>I still love their choice for the namespace separator character (`\`, if you're curious). It's a WTF on its own, but the drama surrounding the choice, including the [reasons](https://wiki.php.net/rfc/namespaceseparator) it was chosen and the other alternatives that were considered, are utterly hilarious.
As a teaser, some of the alternatives considered include `**`, `%%` and `:)`.<|eor|><|sor|>I think this RFC: [problems of namespaces and potential solutions](https://wiki.php.net/rfc/backslashnamespaces) has more information on why backslash was chosen.<|eor|><|sor|>BUT INFORMATION MIGHT GIVE RATIONALE AS TO WHY PHP HAS A SPECIFIC FEATURE. ITS MUCH EASIER TO BASH IT!!<|eor|><|sor|>Actually, the rationale adds fuel to the bashing fire. PHP's rationale lists can often be summed up as (1) a mistake was made, (2) mistake were made in correcting the mistake (3) now we're stuck.
C++ was in the same boat with lambda syntax. C's grammar didn't have a lot of room for growth, and C++ made an early choice not to fix it. Years later, in 200X when the lambda proposal was being drafted, one of the few characters not claimed for starting an expression was '['. So, that's how lambdas start.
The difference is that I've 7 years of C++ experience with nearly every aspect of the language, have barely read about PHP, and yet I can name more guffaws like this in PHP than C++. <|eor|><|eols|><|endoftext|> | 10 |
lolphp | thelordofcheese | cpr8a41 | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Look, I don't like PHP. If it was a choice between getting fired and doing full-time PHP development, I'd polish my rsum.
But isn't this a good thing for the people who are stuck writing PHP and can't avoid it? It's like the more recent improvements to Javascript; ES3 is landmine city, but ES5 is pretty okay and ES6 is gettin' to be an alright thing to use. So sure, the likes of C#, Haskell, or Lisp are better languages, but if you can't *not* write Javascript, it's at least not a bad experience now.
Yes, Javascript's not as bad as PHP, but shouldn't we be happy that those of us who have to endure PHP have *some* niceties?<|eor|><|sor|>JavaScript isn't as bad as PHP because it doesn't try to make kitchen sink soup and isn't engineered by too many cooks.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | serendependy | cpqprkf | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Closures are great and allow for a lot of versatility in your code?
More retarded arguments from the PHP haters. Literally grasping at straws.<|eor|><|sor|>I think you misunderstood what OP was saying. Allow me to translate: "Why would anyone knowledgeable enough to know how to use closures still choose PHP." An argument about why PHP is bad is definitely not being made here, but rather it's an underlying assumption. Given the sub reddit, it's safe to assume that most people here would agree with it.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | HiddenKrypt | cpri91u | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>> Anonymous functions reign supreme in JavaScript, and PHP programmers who don't also know JavaScript are rare. So it was natural for PHP to evolve to include anonymous functions
You know things are really fucked up when your programming language has Javascript as a positive role model and a source of inspiration.
> If you're used to working with closures in JavaScript, then you're already familiar with their power, flexibility, and *sometimes dangerous nature*.
I wonder why he thinks closures are somehow inherently dangerous. At worse its a simpler version of OOP with less room for you to shoot yourself on the foot.<|eor|><|sor|>Javascript is *exactly* the sort of language PHP should have as a role model. Seriously, it's an inspiration. It came from similar roots as PHP (too many cooks, inconsistent design direction) And was (rightly at the time) saddled with a terrible reputation. But it persevered. It changed, and for the better. The "use strict" pragma alone really cleans up the language, and ES6 is a huge change in the direction of a good language design.
Unfortunately, I think you're wrong. PHP isn't using Javascript as an inspiration. Javascript has gotten better largely by attempts to define a [subset of the language](http://i.imgur.com/wR3ZxfB.jpg) worth working with, while carefully introducing new features that mesh well with the existign direction the language has been facing. PHP has been trying to find "The Good Parts" by running out and stealing every little feature they think is missing, all while failing to recognize that it's not what they lack, it's what they *have* that sucks. <|eor|><|sor|>[deleted]<|eor|><|sor|>Javascript has inheritance, it's just wrapped in that strange prototype chain thing. ES6 is adding traditional style class declarations. Personally though, I find that a functional programming perspective makes those features a bit unnecessary. <|eor|><|eols|><|endoftext|> | 9 |
lolphp | jadkik94 | cpqnl1h | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Javascript has closures. I guess it's not the best criteria to judge the developers of a language. ;)
All kidding aside, I think it's a good thing. If you're stuck with PHP at work and get the opportunity to work with an improved PHP, then why not?<|eor|><|eols|><|endoftext|> | 8 |
lolphp | Sheepshow | cprlk82 | <|sols|><|sot|>Why would someone who knows how to use closures, generators, etc. bother with PHP?<|eot|><|sol|>http://www.ibm.com/developerworks/opensource/library/wa-php-renewed_1/index.html?ca=drs-<|eol|><|sor|>Wait, I have to declare what variables my function closes over? Shouldn't the PHP compiler be able to....oh...nevermind.<|eor|><|sor|>C++'s lambda's do the same thing. Any idea why the compiler can't figure it out?<|eor|><|sor|>It does with this syntax: `(/* arguments */)[&]{ /* statements */ }`<|eor|><|eols|><|endoftext|> | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.