> This reads rather awkwardly, because you're claiming to speak for some 
> unknown users ("those who used it") and even for the reader of the message 
> ("it does what you expect it to do").
> 

I speak for myself (and some others, as can be seen by pull requests on some 
FOSS projects, which made pull requests to account for this behaviour), as a 
user of preloading who has encountered this behaviour, understood the reason 
for it and made the required changes to keep using it.

> More helpful would be to say how *you* use it, or where you have seen it 
> used. Evidently it wasn't obvious to Ilija, and wasn't what they expected. 
> Since it's not mentioned in the manual, it's not what I would have expected 
> either.
> 

It was indeed not mentioned in the manual, and preloading is used so rarely (as 
you can see, not even Ilija has been using it) that it seems no one even 
thought of updating it :)

> Ilija also went to some length to describe real practical problems, so just 
> saying there's "nothing wrong with this behaviour" also seems unhelpful. 
> Perhaps you could expand on why you think the problems illustrated aren't 
> significant in practice?
> I would also be interested to know if you think the difference in behaviour 
> between classes and functions is explicitly useful, or just neutral to your 
> use case. 

There is indeed nothing wrong with the listed behaviours IMO, as they make 
sense for how the current logic is working, and aren’t a deal breaker for 
preloading.

In fact preloading in a way behaves as if you included the preload file before 
including the entry point, and doing that even without preloading would issue 
the same behaviour: functions cannot be declared twice, and already-declared 
classes are not autoloaded again, so no error is emitted (when preloading no 
error would be emitted anyway for redeclaration of classes, but in the vast 
majority of cases when using composer already declared classes are not 
re-included by the autoloader, so the end result is the same).

If functions could be autoloaded this edge case could be avoided without having 
to add include guards, but alternatively, it might be a nice idea to simply 
ignore the redeclaration of functions (like for classes), instead of not 
preloading them at all.

Regards,
Daniil Gentili.

Reply via email to