> On Apr 10, 2023, at 20:40, Michael Morris <tendo...@gmail.com> wrote:
> 
> This will be long.

Yes, it's long, so I'm going to focus on a couple things and not quote too much.

> I propose PHP Modules to hold new features.

What you seem to have described is improved lexical scoping.  Rather than a 
shared "global" scope for classes, functions, constants, and variables, you'd 
like to allow files, or perhaps even statement lists (open brace to closed 
brace) to work as either independent or compositional scopes.  Basically, make 
scopes in a certain mode of PHP act more like Javascript.

I'll be honest, if we could throw away PHP's old behavior and make this the 
only mode, I'd be pretty happy.  We can't of course, at best we'd have to mix 
(and yes, I know that's part of your suggestion).

This is a LOT of complexity.

Not impossible, nothing is, but I'm fairly confident it would make maintaining 
the runtime harder, and would notably slow execution.  Not saying "no", since I 
lack that power, but I do want to make it clear how HARD this feature would be 
to implement well.


> PHP Modules also would not
> parse as templates at all - no opening <?php tag needed (and yes, I know
> that will be a headache for IDE makers, but it's not insurmountable).

I would suggest, as a compromise, keep the initial open tag (or maybe an 
alternative one, like <?phm ). Require it come first, and not permitting 
closing tag.  This would simplify webserver config (and avoid making file 
extensions special) while simplifying the experience in editors.  Just a 
suggestion.


> I hope this helps, or at least spurs a conversation to come up with
> something to address this issue.

Lastly, like the stability thread, this isn't a new suggestion, and I'd 
recommend googling back through the archives for prior discussions.  Past 
failures don't mean it won't work today... Opinions change and so does the 
runtime, but it may be helpful to understand the complexities presented by this 
strategy, and what the objections to it will likely boil down to.

See also "PHP Editions" which is a different, but closely related proposal put 
forth by Andi as recently as the 7.x era.

-Sara
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to