PHP core developer and technical writer for the PHP documentation, funded by @thephpf
Lead maintainer, and master of typos, for the French translation of the PHP documentation.
Conference speaker who's always happy to rant on stage.
BSc in pure mathematics from Imperial College London
Photograph/Otaku in my spare time
Speaks 🇬🇧🇫🇷🇩🇪🇯🇵

This profile is from a federated server and may be incomplete. View on remote instance

@futurebird@sauropods.win avatar futurebird , to random

Hey!

I'm looking for some simple to understand and impressive examples of fun things teens might want to do with PHP.

Ideally interactive things their friends might want to try on a local intranet server.

PHP mixes with HTML in a really fun way, and I remember doing some neat tricks with it... but I'm very rusty.

What are the cutest things you've ever seen done with PHP?

(We will get to the issues with security later. Fun first.)

Girgias ,
@Girgias@phpc.social avatar

@futurebird first thing I ever built with it when I was a teen was a public chatroom that used the HTML <meta http-equiv="Refresh"> tag to update the room. Somewhat janky but quite fun. :)

@thephd@pony.social avatar thephd , to random
Girgias ,
@Girgias@phpc.social avatar

@thephd Can I suggest taking inspiration from Raku and its range syntax? [1]

1 .. 5; # 1 <= $x <= 5  
1^.. 5; # 1 < $x <= 5  
1 ..^5; # 1 <= $x < 5  
1^..^5; # 1 < $x < 5  

[1] https://docs.raku.org/type/Range

Girgias ,
@Girgias@phpc.social avatar

@thephd just double checked Kotlin and it uses similar syntax to Swift and your proposal https://kotlinlang.org/docs/ranges.html so there is some precedence for it, but I don't think either of them support excluding the starting point of the range.

@mcc@mastodon.social avatar mcc , to random

The power of Rust is not that it is "close to the metal" but rather that it is close to the compiler backend. Rust doesn't attempt to make you frame your code in a way that the hardware will execute well, but rather to frame it in a way that the LLVM optimizer will optimize well. This is the correct decision since your C code after all will be processed through that same optimizer before it touches anything resembling metal

Girgias ,
@Girgias@phpc.social avatar

@mcc I have started to keep "C Is Not a Low-level Language. Your computer is not a fast PDP-11." [1] in my back pocket every time someone tells me this.

[1] https://queue.acm.org/detail.cfm?id=3212479

@thephd@pony.social avatar thephd , to random

I gotta see so many posts saying "Rust is slower" and like I think these people just evaluate languages and designs based on vibes and not based on like the material output from the compilers.

Girgias ,
@Girgias@phpc.social avatar

@thephd I've got used to it from people telling me Python is faster than PHP, when PHP is twice as fast compared to Python on nearly every pure language benchmark.

@euneuber@graz.social avatar euneuber , to random German

Great talk by @thephd

https://www.youtube.com/watch?v=dCTyu3awI1A

about operator overloading in C

Girgias ,
@Girgias@phpc.social avatar

@euneuber @thephd
This is possibly a really really dumb idea for handling the temporaries.
Would something like _Operator(op1, op2, left, middle, right, temp_destructor) that code gen:

T1 = left op1 middle;  
R = T1 op2 right;  
temp_destructor(T1);  

Work?

Yes this means you'd need to write a lot of these if you support multiple operators. But this would be explicit, and if you add some attributes like associative and commutative to help rearranging that would reduce the combinations.

@thephd@pony.social avatar thephd , to random

📢 It's time for you to MAKE YOUR VOICE HEARD 🗣️...

... In the C Survey for the Name of a new Operator!! This one, being something a LOT of you are familiar with! Read the post and then tell me about how YOU feel bout this common C construct in the survey!

Read up, let us know, and SPREAD THE WORD: https://thephd.dev/the-big-array-size-survey-for-c

🎨: https://www.kiingkiismet.com/

Girgias ,
@Girgias@phpc.social avatar

@thephd My choice is clear, countof() because PHP uses count()!

@eniko@peoplemaking.games avatar eniko , to random

so i know that it's modern to hate exceptions in programming languages, but what are the alternatives besides obsessively checking every return value? this includes monads which are just fancily obsessively checking return values while wearing a top hat and monocle

Girgias ,
@Girgias@phpc.social avatar

@eniko Algebraic Effects and Effect handlers? (which yes are also a way to implement exceptions in another trench coat)

Error handling will always be some variation of interrupt your current flow of execution and go somewhere else. The way how this is done and exposed on a conceptual level is where all the fun is.

@lina@vt.social avatar lina , to random

On the Zig vs. Rust debate, people like to focus on memory safety, but Rust's RAII is just as important to writing clean, maintainable code.

There is something truly magical about seeing my GPU driver cleaning up dozens of nested GPU and host objects when the GPU job completes. Always exactly then, never too early, never too late, never leaking anything. That's all thanks to RAII and automatic Drop calls.

defer foo.deinit() really doesn't cut it. You have to explicitly write it, and it only works if all code paths free the object at the end. errdefer is just a special case, and then the only way to know if you forgot it is by testing with a leak checker. And then the deinit function has to manually deinit all child objects.

All this stuff is just done automatically in Rust. Most of my types don't even implement Drop, or only do something trivial there, because the compiler recursively dropping objects is 99% of the work.

It's knowing the compiler is on your side and taking care of all this that makes it magical. If you have to write out the code by yourself, that's more work, and a huge chance for bugs. The compiler is doing some very complex tracking to figure out what to drop when and where. You'd have to do that all in your head correctly without its help.

Girgias ,
@Girgias@phpc.social avatar

@meatlotion @lina This is an insane statement. I have fixed multiple people's code, from extremely smart and competent people, by enabling GCC/Clang compiler warnings to catch very easy mistakes (i.e. if (x > 15 && x < 0) {}).

The point of a compiler, and abstractions in general, is to allow you to work on a higher semantic level without needing to care about the inner workings of it 99% of the time, which allows you to focus on the things that matter.

Girgias ,
@Girgias@phpc.social avatar

@meatlotion @lina Then maybe "trust" people with more experience about their opinion.

This sort of thinking is why other engineering disciplines think software is a joke. Eh why should I use a harness when going up on a scaffolding, just don't fall, if you do, that is a skill issue.

Eh let me manually do all of those complicated force calculations for this tunnel I'm building, if I mess up the only consequence is for it to collapse and kill a couple thousand people.