<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hacker News: bwoebi</title><link>https://news.ycombinator.com/user?id=bwoebi</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Sun, 24 May 2026 19:50:47 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=bwoebi" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by bwoebi in "PHP's Oddities"]]></title><description><![CDATA[
<p>The key type changing is generally not a problem per se, but it's definitely odd with the default re-indexing behaviour depending on whether something is integer keys only or not.<p>That's exactly what I've been complaining in my post above. If there were no automatic reindexing, then this wouldn't be a problem either.</p>
]]></description><pubDate>Sat, 23 May 2026 20:15:44 +0000</pubDate><link>https://news.ycombinator.com/item?id=48251042</link><dc:creator>bwoebi</dc:creator><comments>https://news.ycombinator.com/item?id=48251042</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48251042</guid></item><item><title><![CDATA[New comment by bwoebi in "PHP's Oddities"]]></title><description><![CDATA[
<p>Arrays in PHP are mostly confusing if you are used to them in other languages.
Instead of $array[0] - the first element is accessed via array_first().<p>Having them as key-value means, that you can easily just remove some items in the middle, during iteration etc. No automatic shifting happening.<p>The thing which bites me is when some internal functions actually reindex the array. array_filter does not, but for example array_reverse, array_slice etc. do (preserve_keys always defaults to false). And for array_merge too, but there it's no array_merge(preserve_keys: false), but instead the + operator. (Why is this operator overloaded?!)<p>On the topic of the uninitialized state, as co-author of that RFC:<p>I agree with the author that nullable properties should have been auto-initialized to NULL. I haven't ever seen any benefit of an uninitialized state for these. Some co-authors of that RFC disagreed and wished for consistency with the other typed properties. The good thing probably is, that we still could opt to change this with a relatively minor BC break.<p>For non-nullable properties, I do think there is value. Not every value is actually available/ready in a constructor. Sure you can assign dummy values to properties. But it's requiring you to then manually guard/assert that the property is actually initialized. If you happen to access a non-nullable typed property without isset(), then your code is likely broken anyway and I'm grateful for the Error exception thrown.<p>Also, PHP has this peculiar feature of ReflectionClass::newInstanceWithoutConstructor(). This is forcibly having an object in an uninitialized state. Whether that feature should exist or not is a good question, but in practice it's helpful for object hydration for example. This was one further motivation to introduce the uninitialized state.<p>The author of the post suggests checking at the constructor boundary. But this doesn't inhibit objects leaking / not finishing the initialization properly. (class Foo { public stdClass $object; function __construct() { global $foo; $foo = $this; } } new Foo; $foo->object ... is now still existing? PHP doesn't have mechanisms to invalidate objects at a distance. That would be the alternative, but also spooky.) Some choices need to be made, and all choices will have some rough edges.<p>Side note: I personally never use is_null(), but nearly always isset(). This nicely checks for the uninitialized state too. Static analysis tells me anyway, when I access a variable or property name which can never exist.</p>
]]></description><pubDate>Sat, 23 May 2026 17:27:23 +0000</pubDate><link>https://news.ycombinator.com/item?id=48249440</link><dc:creator>bwoebi</dc:creator><comments>https://news.ycombinator.com/item?id=48249440</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48249440</guid></item><item><title><![CDATA[New comment by bwoebi in "PHP 8.4"]]></title><description><![CDATA[
<p>C# 13 has this via the field keyword (as preview feature): <a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/field" rel="nofollow">https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...</a><p>It's pretty similar to what PHP provides here, except that PHP uses "$this->propname =" and C# uses "field =".<p>Edit: As someone involved in the RFC, it's somewhat funny, because we considered a special variable like "$field" or "$value" too magic, and C# does just that with a field keyword.</p>
]]></description><pubDate>Thu, 21 Nov 2024 23:38:18 +0000</pubDate><link>https://news.ycombinator.com/item?id=42209808</link><dc:creator>bwoebi</dc:creator><comments>https://news.ycombinator.com/item?id=42209808</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42209808</guid></item><item><title><![CDATA[New comment by bwoebi in "PHP 8.4"]]></title><description><![CDATA[
<p>While variable-length lookbehind is surely more comfortable to work with, I found clever usage of \K to be largely sufficient in most cases.<p>But I agree, a great feature!</p>
]]></description><pubDate>Thu, 21 Nov 2024 23:31:31 +0000</pubDate><link>https://news.ycombinator.com/item?id=42209767</link><dc:creator>bwoebi</dc:creator><comments>https://news.ycombinator.com/item?id=42209767</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42209767</guid></item><item><title><![CDATA[New comment by bwoebi in "PHP 8.4"]]></title><description><![CDATA[
<p>readonly is rather a misnomer for "writeonce" in PHP. And as such it also disallows repeated assignment in class scope, while private(set) has no such restriction.</p>
]]></description><pubDate>Thu, 21 Nov 2024 23:27:38 +0000</pubDate><link>https://news.ycombinator.com/item?id=42209744</link><dc:creator>bwoebi</dc:creator><comments>https://news.ycombinator.com/item?id=42209744</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42209744</guid></item><item><title><![CDATA[New comment by bwoebi in "PHP 8.4"]]></title><description><![CDATA[
<p>array_find parameter ordering is modeled after other non-variadic array functions, e.g. array_filter also having ($array, $callback) order.<p>But I agree, there is already some inconsistency, and when adding a new function you have to choose which function to make it consistent and which one to make it inconsistent with.</p>
]]></description><pubDate>Thu, 21 Nov 2024 23:25:26 +0000</pubDate><link>https://news.ycombinator.com/item?id=42209730</link><dc:creator>bwoebi</dc:creator><comments>https://news.ycombinator.com/item?id=42209730</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42209730</guid></item><item><title><![CDATA[New comment by bwoebi in "Upcoming Hardening in PHP"]]></title><description><![CDATA[
<p>I found this approach works best with languages having method overloading. For PHP it felt quite limiting, and it also requires you to have more complexity and overhead with wrapping.<p>But I have no hard evidence at hand, only how I experienced that in PHP.</p>
]]></description><pubDate>Fri, 15 Nov 2024 19:37:14 +0000</pubDate><link>https://news.ycombinator.com/item?id=42150123</link><dc:creator>bwoebi</dc:creator><comments>https://news.ycombinator.com/item?id=42150123</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42150123</guid></item><item><title><![CDATA[New comment by bwoebi in "Upcoming Hardening in PHP"]]></title><description><![CDATA[
<p>One of the main advantages of actually allowing more arguments is forward compatibility:<p>You can, within a library, provide an additional argument to a callback without actually introducing a BC break for all users.<p>My favorite approach would be allowing too many args on dynamic calls (closures, and function calls with dynamic name, not method calls in general) and otherwise rejecting it.</p>
]]></description><pubDate>Fri, 15 Nov 2024 14:21:51 +0000</pubDate><link>https://news.ycombinator.com/item?id=42147191</link><dc:creator>bwoebi</dc:creator><comments>https://news.ycombinator.com/item?id=42147191</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42147191</guid></item></channel></rss>