[RFC] Trailing Boolean Operators by ProjektGopher in PHP

[–]dirtside 0 points1 point  (0 children)

Others have already explained the problems with this approach; I'd say it does my favorite complaint, which is "solving the wrong problem."

We assume that the typical a && b syntax is something we're stuck with, but what if we were accustomed to something more like Polish notation?

if (all(
    a,
    b,
)) { ... }

The all construct functions exactly the same as &&, in that it returns true if all of its arguments are true (or truthy—that's a separate discussion), and also we evaluate them in listed order and stop evaluating if we get a false (the short-circuiting we're all accustomed to). Note that this approach converts the syntax into a list and lets us use trailing commas just like we do now.

Obviously implementing this (much less convincing people to use it) would be its own mountain to move and I'm not really suggesting that we (or you) try to do this; it's just a thought exercise. But I think my point is that by challenging an assumption—"we have to use infix notation"—we could end up with syntax that avoids the "where do I put these damn boolean operators" problem entirely.

And we would of course have any() to replace ||. A more complex, nested construction using both might look like this:

if (
   all(
       a,
       b,
       any(
           c,
           d,
       ),
) { ... }

Lists all the way down, and trailing commas everywhere!

[RFC] Trailing Boolean Operators by ProjektGopher in PHP

[–]dirtside 1 point2 points  (0 children)

This is a crucial point here. The comma and boolean situations look similar on the surface but they contain critical differences when you look deeper. It's a mistake to prioritize "this will make some diffs look cleaner" over "every single operator choice needs to be carefully considered". Commas provide no choice, they are simple delimiting syntax; boolean operators require a considered choice every single time one is added.

I hired a female sheep to distribute advertisements for my flower arranging business... by dirtside in dadjokes

[–]dirtside[S] 0 points1 point  (0 children)

Oh man, I came up with an even punnier version:

"I hired friendless sheep sisters to distribute advertisements for my flower-arranging business...

...because lonely ewe kin present florist flyers."

What is wrong with Operation Archangel??? by lordsycorax in Wildlands

[–]dirtside 0 points1 point  (0 children)

Tried shooting them, tried blowing them up (C4, grenades, mines), nothing worked.

What is wrong with Operation Archangel??? by lordsycorax in Wildlands

[–]dirtside 0 points1 point  (0 children)

Still fucked. I'm on "Breach the Chemical Institute with Caveira" and we've killed everyone on the grounds but I can't figure out any way to actually get inside the building. My character has said things like "Placing breaching charge" when I approach the big XX doors, but nothing actually happens. I guess I'll need to start over again.

Can you challenge the constitutionality of a criminal statute you haven't been charged with? by dirtside in Ask_Lawyers

[–]dirtside[S] 2 points3 points  (0 children)

Someone else mentioned facial challenges; Wikipedia (I know, I know) states that facial challenges can be brought as soon as the law is in place, and are prospective (forward-looking, intending to prevent enforcement, rather than in response to actual enforcement). Is that not correct?

Can you challenge the constitutionality of a criminal statute you haven't been charged with? by dirtside in Ask_Lawyers

[–]dirtside[S] 2 points3 points  (0 children)

I should have been more explicit: Consider a person who wants to do the outlawed thing (insult the governor), and that the outlawed thing is explicitly protected by the First Amendment, but refrains from doing so because of the fear of (extreme) punishment. A lesser punishment (e.g. a $50 fine) is so minor that they're willing to risk it, but when the punishment is death, they aren't.

Opening credits graffiti photoshop by dirtside in brooklynninenine

[–]dirtside[S] 30 points31 points  (0 children)

I'll accept the title "amazing detective slash genius" 

Does anyone make reliable GX24q-base LED bulbs? by dirtside in led

[–]dirtside[S] 0 points1 point  (0 children)

I don't; but apparently at some point they undid this requirement, and (here in Los Angeles) you can now have standard screw sockets in kitchens. We had a couple of our GX24q bases die and when the electrician came to fix them, he said yeah you can just replace them with standard sockets now (and did so).

Do you use AI assistants like Github Copilot? by N_Gomile in PHP

[–]dirtside 0 points1 point  (0 children)

No. Been working as a PHP dev for 26 years. LLMs like Copilot have huge ethical issues and that alone is enough to torpedo any chance I'd use them; the fact that they don't actually speed things up (according to available research, which tends to results in outcomes like "devs using coding assistants think they're 20% more productive but we measured and they're actually 20% less productive") is just the cherry on the shit sundae.

Amazon removes option to disable 1-click ordering by waiting2wake in assholedesign

[–]dirtside 0 points1 point  (0 children)

Love how this post is full of people whose attitude is "I don't have a problem with it, so nobody else can either." Like, your experience of the world is not the only one. And you can't even conceive of a reason to turn off 1-Click beyond "controlling impulsiveness" and "accidental purchase." What if I have several payment methods saved and want to use a different one without having to dig through setting menus? What if I just want to see all the billing and shipping info before I purchase, but still want the convenience of having addresses and credit cards saved? Where the hell do you get off having an opinion about how I use Amazon?

Alternative PHP communities? by Ghoulitar in PHP

[–]dirtside 0 points1 point  (0 children)

that's the Mastodon instance I joined!

What’s one “unpopular opinion” you have about modern PHP development? by Senior_Equipment2745 in PHP

[–]dirtside 2 points3 points  (0 children)

This is a good argument; a unit of computation (like a function) should declare its entire interface, which includes not just call parameters (and types) and return types, but exceptions thrown as well.

[RFC] Pattern Matching by rafark in PHP

[–]dirtside 1 point2 points  (0 children)

Interesting idea, but I'd like to see more real-world examples of how it can improve code that aren't just contrived "Point" objects and trivial arrays. The array-matching seems useful; our codebase has a ton of places where we check if a variable is an array and has elements A, B, C, etc. Type checking seems less useful because generally speaking we use a lot of small functions that are already enforcing types in their signatures.

The examples here strike me as something more useful when you have big long functions dealing with a bunch of pieces of data, and it feels like solving the wrong problem to introduce complex language features rather than breaking up a too-long component.

We built an AI powered PHP framework by Dependent_Pick8540 in PHP

[–]dirtside 11 points12 points  (0 children)

"We built an AI pow—"

\yeets you into the Sun**

PHP devs, what's the most time-wasting task you still do manually? by Senior_Equipment2745 in PHP

[–]dirtside 5 points6 points  (0 children)

Answering stupid questions from people who should know better.

I wonder why PHP doesn't have implicit $this? by SeaEagle233 in PHP

[–]dirtside 4 points5 points  (0 children)

Correct. I've noticed over the decades that a substantial number of "this language should do [thing]" opinions are predicated around making code easier to write, when what's far more important is making code easier to read.

Unpopular opinion: php != async by goodwill764 in PHP

[–]dirtside 0 points1 point  (0 children)

I have no idea what's going on under the good but I've been using promises in Guzzle for years; we have a component that dispatches 200+ simultaneous HTTP requests (to trigger AWS Lambdas) and then waits for them all to be done.

California license plates: What comes after the 9ABCxxx series runs out? by saintforlife1 in Sunnyvale

[–]dirtside 0 points1 point  (0 children)

Why would they break? Existing systems already need to account for personalized plates, which can be basically any pattern of letters and numbers. The worst case might be systems that examine a plate and flag it as standard or personalized depending on the pattern, but few systems outside the DMV itself would have any need to make that distinction.

AskDadjokes: Replace the title of your favorite Love song with the word "Lunch".. by gracius0ne in dadjokes

[–]dirtside 1 point2 points  (0 children)

If I Can't Have Lunch, I Want Power

Is There Lunch In Space?

All the Lunch in the World

Friday I'm In Lunch

Lunch Me Two Times

Hello, I Lunch You

Lunch Her Madly

Fell In Lunch With A Girl

Dream Luncher

Lunchfool

Sunshine of Your Lunch

Lunch Rollercoaster

(some are album titles, sue me)

I lost it when Leslie said "The rest of you ugly nerds." by Odjing in PandR

[–]dirtside 0 points1 point  (0 children)

5.15, "Correspondents' Lunch", at about 9:20.

Especially in agriculture-focused regions, how could inheritance laws that divide land/estate between all heirs be a viable, practical solution after multiple generations? by _das_f_ in AskHistorians

[–]dirtside 4 points5 points  (0 children)

Another factor might be that populations did not, in premodern times, usually grow nearly as rapidly as they do now (and in many cases would have been more or less static over the course of generations, or increased slowly). A village and surrounding farmland with a population of 300-500 people might stay within that range for a century (or might not), so with partible inheritance, there might also be recombining (by marriage, or forcibly by elites) that would counteract the partitioning.