@Crell I think I've said this before. Adding something that either does pre-processing or allows users to hook in to when compile errors occur (and so only transform a file when it has unknown syntax) is a generic thing that would make it possible for people to write code that uses generics without committing core to a particular syntax.
The difficulty of the argument would probably come from people who experience the "not great" experience that pre-processing has in JavaScript.
I hate password fields like that. More than once I've noped out of registering for a thing because I couldn't get through the requirements. Special call-out to ancestry.com...
Tried registering through their site a couple years ago, password requirements were ridiculous, and IIRC I went through the trouble of trying to make my password comply, and it still was "missing something" so... yeah... they're not getting my data then...
Because nothing ever good comes from it... I should complain on Twitter
@Danack IMO the macro syntax etc problem has already been solved, psalm / phpstan are way ahead of us (and it's a very common format used in many other languages). The thing that is missing is a) the ability to use them inline without docblocks and b) some kind of engine-transparent define to specify which variant it's used... i mean it'd be standardised within a week either way
@Crell Probably not. I meant something that transforms a PHP file when PHP can't compile it.
@MarkR that's fixing a specific problem, which is different from being able to fix the generic type of the problem - that PHP is not really extendible from userland.
plus it moves that conversation to be owned by core, which is also a bad thing
IMO until PHP comes out with its own official static analysis engine, there's still going to be a huge amount of things which become "it's psalms problem" and IMO if we can make it easier and more fluent to use in core, all the better
@Crell that's annoying for local dev work. Having to run something in the background is one of the things that makes JS more annoying than PHP.
> we're back to "It's Psalm's problem", which is not the goal.
Meh. It probably moves it closer to being usable, and it could allow the whole conversation about syntax to happen outside of core, which both relieves work on core contributors and means it can iterate separately from core.
I'd ask you to explain how much experience you have with comparative environments, because IMO the working experience with something transpiled / analysed like TS or PHP + psalm is enormously more enjoyable than without.
@NikiC I can't see a page for the stub generation on phpinternalsbook.com - if I made one, should it be a page under 'Building PHP' or somewhere else?
@MarkR I think I get all the benefit from my IDE through autocomplete which works fine for both PHP and Preact/JSX stuff transpiled to JS.
There's a strong likelyhood I'd be able to save a bit of time using generic storage containers, rather than creating specific storage containers......but not sure it would be world altering.
I think if something as simple as array<Foo> was introduced natively, you'd see old version of PHP that didn't support it being abandoned reallllly quickly
btw, i'll offer a starting $1k at anyone (via the foundation) who wants to try tackling struct-like / TS Interface-like objects with a meaningful splat / clone + new property mechanism.
I <3 me readonly DTOs w/ constructor property promotion, but damn if create a new instance with a single changed value isn't fugly as hell (runtime reflection + array usually)
@MarkR I wonder if generic arrays could be an opportunity to fix the numeric string key coercion as well. E.g. an array<string,Foo> wouldn't coerce keys. Could be practicable as long as the type is explicitly specified.
I like arrays though :D Having a native LinkedHashMap in the language is really great for many tasks. Fixing key the coercion problem and adding the list and map types as specializations of arrays would be perfect. And array shapes.