News for hackers. Stuff that matters.
Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @04:12AM (#42664499)
> PHP 8 is a top notch language

Maybe the things they've added lately have been well designed, but did they ever actually fix the WTFs from PHP 4?

JavaScript has the same problem. They added `let` and `const` but never removed `var` or `==`. If you take a look at ESLint rules there are dozens of footguns that could have been fixed in the language. Not as bad as PHP's footguns, but still...

Re:XYPlorer Is Written in VB6 by stefanfisk on Saturday January 11, 2025 @04:58AM (#42664687)
I spend all of my working hours with modern PHP.

IMHO, although its improved A LOT it’s still a mess. But with the right tooling you can kinda-sorta make it behave like a sane language if you squint a bit.

Re:XYPlorer Is Written in VB6 by tonyedgecombe on Saturday January 11, 2025 @07:48AM (#42665510)
>I spend all of my working hours with modern PHP.

I'd love to see a PHP without the warts. Something that is trivial to embed in a web page just the way PHP is but without the foot guns.

Re:XYPlorer Is Written in VB6 by dalemhurley on Saturday January 11, 2025 @05:22AM (#42664803)
Every single language is a mess. Just look at time and floating point numbers in Java (not having a go at Java).
Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @05:35AM (#42664889)
Every single language has parts that are a mess, or at least not perfectly designed. But that doesn't mean that languages all have an equal amount of mess. Python clearly has less mess than Perl. Rust clearly has less mess than C++. Zig clearly has less mess than C.

There should be a name for the "nothing is perfect so everything is equally bad" fallacy. It's surprisingly common.

Re:XYPlorer Is Written in VB6 by networked on Saturday January 11, 2025 @06:25AM (#42665143)
The fallacy of gray?

https://www.greaterwrong.com/posts/dLJv2CoRCgeC2mPgj/the-fal...

> The Sophisticate: “The world isn’t black and white. No one does pure good or pure bad. It’s all gray. Therefore, no one is better than anyone else.”

> The Zetet: “Knowing only gray, you conclude that all grays are the same shade. You mock the simplicity of the two-color view, yet you replace it with a one-color view . . .”

> —Marc Stiegler, David’s Sling

Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @07:41AM (#42665483)
Ah nice, thanks!
Re:XYPlorer Is Written in VB6 by guenthert on Saturday January 11, 2025 @06:26AM (#42665146)
> There should be a name for the "nothing is perfect so everything is equally bad" fallacy. It's surprisingly common.

I think this falls under splitting (black-and-white thinking), a form of defense mechanism or (I suspect) mere rhetorical tool.

https://en.wikipedia.org/wiki/Black_and_white_thinking

Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @01:07PM (#42667712)
No, black and white thinking is a different thing. It's "the fallacy of grey", linked in a sibling comment.
Re:XYPlorer Is Written in VB6 by donatj on Saturday January 11, 2025 @09:26AM (#42666087)
In Python, default arguments are mutable. That's the ultimate WTF and footgun.
Re:XYPlorer Is Written in VB6 by orbisvicis on Saturday January 11, 2025 @09:52AM (#42666254)
That's somewhat of misnomer. The root cause is that default arguments are evaluated during function creation rather than when the function called. And... this is invaluable for forcing immediate evaluation of otherwise late-binding closures.

What can be confusing is mixed lifetimes of nested generators using `yield from`. If any outer generator has a shorter lifetime, when it is garbage collected `yield from` will forward `close()` to the inner generator. Attempting to re-use the inner generator will result in a premature `StopIteration`. Iterators do not have `close()` and so are unaffected. This affects only `yield from` and not `for i in gen: yield i`.

Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @01:15PM (#42667777)
Yeah that is definitely a footguns but I think calling it the ultimate footgun is overselling it. Perl implicitly casts between strings and integers. That's a waaaay bigger footgun.
Re:XYPlorer Is Written in VB6 by aspenmayer on Saturday January 11, 2025 @01:01PM (#42667656)
> There should be a name for the "nothing is perfect so everything is equally bad" fallacy. It's surprisingly common.

https://en.wikipedia.org/wiki/Perfect_is_the_enemy_of_good

Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @01:07PM (#42667705)
That's a totally different thing.
Re:XYPlorer Is Written in VB6 by aspenmayer on Saturday January 11, 2025 @01:10PM (#42667738)
Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @04:43PM (#42669147)
Also not the same thing. That would be someone saying "we can't use any language because they all have flaws".

The one I'm talking about is the fallacy of grey, linked from a sibling comment.

Re:XYPlorer Is Written in VB6 by DanielHB on Saturday January 11, 2025 @05:56AM (#42665002)
There are lasting languages and good languages, but there are no lasting good languages.
Re:XYPlorer Is Written in VB6 by nycdotnet on Saturday January 11, 2025 @09:07AM (#42665957)
“There are only two kinds of languages: the ones people complain about and the ones nobody uses.”. Bjarne Stroustrup
Re:XYPlorer Is Written in VB6 by DanielHB on Monday January 13, 2025 @06:43AM (#42682453)
Although I don't disagree with that statement it is not exactly what I was implying. I was implying that good languages eventually grow into bad languages.

Usually happens through tacking on new features and standard API functions without removing old ones. I wish modern languages would allow different modules within the same project to use different versions of the language and be more aggressive about deprecating/removing old features.

So like if you open a module and see "version 3.0" in the manifest you know for sure that this module is not using stupid feature X from version 1.0. While still being able to use "crucial library not updated since 2003" without much fuss.

Most languages these days don't dare to change core syntax behaviour in order to not break backwards compatibility.

Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @04:47PM (#42669181)
Nonsense. There are plenty of good languages that have lasted a while, unless your standard for "good" is unreasonably high.

Java is probably the longest lasting language that I would consider good. Are there things that I hate about it? Of course. But it got a lot of things right - even things that more modern languages have done much worse at, like IDE support.

Re:XYPlorer Is Written in VB6 by MrBuddyCasino on Saturday January 11, 2025 @07:15AM (#42665371)
> Just look at time and floating point numbers in Java

What do you mean? The time & date API in Java is excellent, and the float and double types follow the IEEE standard.

Re:XYPlorer Is Written in VB6 by badlibrarian on Saturday January 11, 2025 @08:41AM (#42665799)
It took nearly 20 years to sort it out. Before Java 8, January was 0 and getYear() for today would return 125.
Re:XYPlorer Is Written in VB6 by stefanfisk on Saturday January 11, 2025 @10:43AM (#42666579)
Wasn’t Java 8 released 11 years ago? If PHP had been in its current state back then it would have been a masterpiece.
Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @04:52PM (#42669214)
January as 0 seems like a very definsible choice. Presumably they did it to match C. If anything the WTF there is that the day of the month doesn't start from 0.

Dunno what's up with getYear() though!

Re:XYPlorer Is Written in VB6 by divbzero on Sunday January 12, 2025 @12:05AM (#42671420)
getYear() must have been written in the 1990s during the early years of Java:

   95 = 1995
   96 = 1996
   97 = 1997
   98 = 1998
   99 = 1999
  100 = 2000 !?
Re:XYPlorer Is Written in VB6 by desdenova on Saturday January 11, 2025 @06:38AM (#42665204)
Taking two of the worst languages as an example of "every single language" doesn't really work.
Re:XYPlorer Is Written in VB6 by mschuster91 on Saturday January 11, 2025 @05:20AM (#42664792)
> but did they ever actually fix the WTFs from PHP 4?

If you have a background in C programming, most of the "wtf" is completely reasonable - the only thing "modern" and novice PHP programmers will still raise the WTF flag about is the standard library, mostly the string manipulation functions, their names and argument order. Old dogs know that this comes from early PHP being not much more than a thin wrapper around libc and various other C libraries.

Other than that, if you write modern PHP it's almost like Java, just without threads/concurrency in general, and without extremely braindead tooling required to get something built. PHP Composer is a breeze compared to Gradle, Maven and messing around with Tomcat, Glassfish and classpaths to get your application deployed...

Re:XYPlorer Is Written in VB6 by dalemhurley on Saturday January 11, 2025 @05:25AM (#42664824)
Then add in Laravel and chefs kiss.

Honestly 90% of web apps could be easily built with PHP, Laravel, Inertia and React/Vue in half the time.

Re:XYPlorer Is Written in VB6 by odie5533 on Saturday January 11, 2025 @09:49AM (#42666234)
How is that any better than React + <insert any backend here>?
Re:XYPlorer Is Written in VB6 by AdrianB1 on Saturday January 11, 2025 @11:17AM (#42666839)
PHP is extremely simple to use. That makes it extremely simple to onboard new people and also to support. Complexity brings associated costs, sometimes bigger than the development itself.
Re:XYPlorer Is Written in VB6 by odie5533 on Saturday January 11, 2025 @12:16PM (#42667288)
Last time I created a Laravel app it created dozens of default files and folders for me. How is that simpler than Go/Gin or Python/Fastapi? When does the extremely simple part come in?
Re:XYPlorer Is Written in VB6 by mschuster91 on Saturday January 11, 2025 @12:25PM (#42667347)
For one, PHP doesn't require bundlers to work, nor does it require compilers, transpilers, watchers or whatever. You just save your code in your editor of choice and that's it.
Re:XYPlorer Is Written in VB6 by odie5533 on Saturday January 11, 2025 @12:44PM (#42667500)
The proposition was PHP, Laravel, Inertia and React/Vue. Pretty sure Inertia is basically a transpiler to JS, and building the components in React will use a watcher for compilation. Not sure if it has TypeScript support.

Also, you still run artisan to view your code after you save. Same thing with Python's FastAPI: I run FastAPI's server. I just save my code just like PHP.

Re:XYPlorer Is Written in VB6 by AdrianB1 on Saturday January 11, 2025 @06:21PM (#42669763)
You don't have to use Laravel. If you want more advanced stuff to be built in, go for it, but I can write reasonably complex apps with plain PHP. How simple is it? I showed a DBA with no programming experience (other than SQL) to make a change in an existing app in ~ 2 hours. The change was a new feature in the app, about ~ 100 loc. I also gave a complete non-technical colleague a small PHP application to own and support and it works quite fine 2 years later.
Re:XYPlorer Is Written in VB6 by AlienRobot on Saturday January 11, 2025 @06:58AM (#42665287)
It's not possible to remove anything without potentially breaking backwards compatibility. Removing ANYTHING in Javascript would be a tremendously bad idea.

If webpages from 30 years ago stopped working because 2025 developers favor aesthetics and disrespect legacy, I'd be pretty angry.

Re:XYPlorer Is Written in VB6 by tonyedgecombe on Saturday January 11, 2025 @07:55AM (#42665539)
I do like the way Rust has language editions which let you work around this, at least partially.

Mostly though I don't care if we break old stuff. It happened all the time when developing for the desktop. People just dealt with it. The ones most impacted are lazy enterprises and I have no sympathy for them.

Clinging on to the past stifles innovation.

Re:XYPlorer Is Written in VB6 by AlienRobot on Saturday January 11, 2025 @12:11PM (#42667247)
The loss of being unable to access old information is unknowable and therefore infinite. People can't just "deal with it." Every year there is more technical baggage that someone new to the environment is just supposed to learn. At some point it becomes an impregnable barrier.

If you start telling people they have to install an obsolete web browser, and then an obsolete operating system, and then patch the drivers because all the hardware doesn't support it anymore, you have effectively gatekept information that was once available in the open web to the tech elite.

Yes, "tech" is redone from scratch every 6 months so 5 years ago is an eternity, but there are plenty of fields where 30 year old information is just as invaluable as something published today.

Nobody is maintaining webpages published in the 90's. Nobody is going to update them. They are just there, sitting on some university's server that barely gets any hits. The author probably died 12 years ago and nobody even remembers who is responsible for it or that it's running. And it's in everyone's best interest to keep it that way: online.

Re:XYPlorer Is Written in VB6 by tonyedgecombe on Sunday January 12, 2025 @05:36AM (#42672573)
I think the cost is too high. If people want that information then they will find a way. If not then it probably wasn't that valuable.

The reality is that we have already given up in many areas, try and run a 16 bit Windows application on Windows 11, try and run a Node app you haven't updated for ten years, try and run early versions of OS/X and see how much internet dependent functionality has been lost, try and view an email with linked assets, try and run a web page with a Java or Flash applet.

Re:XYPlorer Is Written in VB6 by AlienRobot on Sunday January 12, 2025 @11:16AM (#42674596)
The only people who can find a way are technical people. The average person can't do it.

And we can't tell how valuable it is because we don't know what we are losing.

If we burn down the Library of Alexandria, was there anything valuable in there? We don't know, because it's all burned. It's inaccessible. It's too much stuff to verify before doing it, and we can't tell after we do it, so I'd rather we don't burn down the whole thing since we don't know what's inside.

And every time it does happen, it's a massive loss.

You have no idea how much I grief the fact flash games are no longer a thing. If newgrounds still had flash today, the Internet would be a much better place.

Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @07:42AM (#42665486)
> It's not possible to remove anything without potentially breaking backwards compatibility

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:XYPlorer Is Written in VB6 by AlienRobot on Saturday January 11, 2025 @12:20PM (#42667304)
>In sloppy mode, a number beginning with a 0, such as 0644, is interpreted as an octal number (0644 === 420)

How does something like this even happens.

Anyway, if you "use" strict mode, but the browser doesn't support it, you're effectively not running in strict mode, so you can't actually assume the Javascript will execute differently.

Re:XYPlorer Is Written in VB6 by bakkoting on Saturday January 11, 2025 @03:43PM (#42668779)
Every version of a browser released after 2011 has supported strict mode.
Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @05:46PM (#42669566)
Any code that works in strict mode will also work in sloppy mode.

0777 style octal numbers are a footguns inherited from C. Don't ask my why they made that mistake! Modern languages use 0o777.

Re:XYPlorer Is Written in VB6 by philistine on Saturday January 11, 2025 @09:02AM (#42665934)
What do you mean?

We could implement a version declaration system that removes and fixes elements of JavaScript when properly declared.

Re:XYPlorer Is Written in VB6 by deergomoo on Saturday January 11, 2025 @07:45AM (#42665494)
> but did they ever actually fix the WTFs from PHP 4

Depends what you class as a WTF. The older parts of the standard library are still wildly inconsistent in function naming and argument order, but that’s never going to change because it’s simply not worth the BC break.

But they’ve done a good job cleaning up the actually problematic bits of the language. Previous horribly insecure defaults like register_globals and magic quotes are long gone. And in recent years they’ve worked on tightening things up: many obviously incorrect behaviours have been promoted from notices or warnings to outright errors.

Re:XYPlorer Is Written in VB6 by andai on Saturday January 11, 2025 @08:09AM (#42665616)
>depends on what you class as a WTF

It might take a while to enumerate them all ;)

https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

Re:XYPlorer Is Written in VB6 by deergomoo on Saturday January 11, 2025 @08:26AM (#42665706)
There’s some fair points in there, some unfair ones, and some outdated ones (unsurprisingly given it’s nearly 13 years old).
Re:XYPlorer Is Written in VB6 by lordgroff on Saturday January 11, 2025 @09:30AM (#42666110)
PHP never did do a py2->3, but instead took the js route of adding things while being very cautious indeed if breaking compatibility.

I really have very little annoyance with PHP despite retaining some WTFs. In fact, with a modern language server and psalm I find it downright comfortable.

Re:XYPlorer Is Written in VB6 by p_ing on Saturday January 11, 2025 @09:43AM (#42666201)
What is PHP good for these days? What does it do better as a metric than any other language?

It's easy to use, easy to get into for beginners, and is a requirement for WordPress. But performance? Flexibility? Some other random metric-word?

Re:XYPlorer Is Written in VB6 by kgeist on Saturday January 11, 2025 @10:41AM (#42666571)
For me, 2 main advantages PHP has, for real production code, are:

1) Easy hotfixing/debugging on production servers. Just edit a file and save. Our teams which program in PHP solve blockers way faster than the Go teams.

2) "Shared nothing" architecture, which has two advantages:

a) it's scalable without additional effort, because PHP processes are stateless

b) better security, especially if you're doing multitenant SaaS, because all requests are isolated from each other (there was a bug in ChatGPT when you could view chats of other users because requests from different users were served by the same OS process in Python and they had a race condition bug when switching between users inside the same OS process - such bugs are very rare in PHP)

Not saying it's unique to PHP, but these 2 advantages for real production code are often overlooked; people instead focus on non-essential minutiae like "inconsistent function name, I'd name it differently tbh"

Re:XYPlorer Is Written in VB6 by IshKebab on Saturday January 11, 2025 @05:44PM (#42669548)
You can trivially do 2. in any language, although it is true that people rarely do that in other languages because of the downsides. As for live editing production... I dunno if that is a good thing!
Re:XYPlorer Is Written in VB6 by AdrianB1 on Saturday January 11, 2025 @11:14AM (#42666822)
For me: I can quickly build a small thing and run it directly. It is interpreted, no build/CI/CD/whatever. It's not just a more powerful PowerShell, but also something that I can use to build a web page with a data source, Datatables.js and ... 30 minutes later it's good to go.

For my company: minor apps with laxe requirements, hotfixes usually involve editing a single file, in place, then push to Git. We don't have "serious" apps in PHP, but we have a few low tier apps using it, it's simple and convenient.