mposer.org/doc/04-schema.md#psr-4):
> Namespace prefixes must end in \\ to avoid conflicts between similar
> prefixes. For example Foo would match classes in the FooBar namespace so the
> trailing backslashes solve the problem: Foo\\ and FooBar\\ are distinct.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
y rather inefficient.
Perhaps the "register" functions should take an optional list of namespace
prefixes, so that the core implementation can do the string comparison, and
only despatch to the userland code if the requested class/function name matches.
Thanks again for working on this!
quirks" &
"limited-quirks", JS's "use strict" - but it doesn't scale, so it's
never going to replace the genuinely hard question of how to improve a
language for new code, while limiting pain for existing code.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
aft" status rather than "In Discussion", so hasn't been
announced yet, and may not be ready for discussion.
I'll leave it up to Ilija and Larry to say whether your question is
something they know the answer to, or if it's a "known unknown".
Regards,
--
Rowan Tommins
[IMSoP]
t is?
If it cares that it can turn it into an integer, it can just request an
integer directly, or an object implementing an appropriate interface:
interface ErrorValueInterface {
public function getCode(): int;
}
>From the description given, it seems like enums are sinmply the wrong tool
for the job.
Regards,
--
Rowan Tommins
[IMSoP]
o
make clear that this is *not* a sub-type relationship - perhaps something
like "expands", "allows", or "encompasses".
Regards,
--
Rowan Tommins
[IMSoP]
will
complain that you have two methods named "__construct"
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
tionality can always
be added in later if someone comes up with a clean implementation and a
good use case.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
e at all, it will end up as a
shorthand for that constructor example: declaring normal properties, and
populating them as the instance is initialised.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
hing, just as
$this->foo or self::$foo doesn't mean anything outside a class. In fact,
it could be spelled capture::$foo or $scope->foo rather than just using
new punctuation, if we wanted to encourage that analogy.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Developm
xible than they are.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
oughts
into a GitHub Gist here:
https://gist.github.com/IMSoP/4157af05c79b3df4c4853f5a58766341
I'd be interested to hear anyone's thoughts - is this a promising idea
to explore, or have I gone completely off the rails?
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Ma
, '.');
$priceFormatter = number_format(..., decimals: 2, decimal_separator: ',',
thousands_separator: '.');
Arguably the named param version is more explicit, but in some cases it's
significantly longer than manually defining a closure, whereas fully
positional PFA is always shorter.
Regards,
--
Rowan Tommins
[IMSoP]
ger = is_subclass_of(?, LoggerInterface::class, false);
I'm sure I could look through Laravel's documentation, or Symfony's, and
find examples there too.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
o put you off exploring this idea, though, so feel free to take
this all with as many pinches of salt as you want.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
of those features where "the devil is in the
details", and a simpler implementation is possible, but may not be
desirable.
Regards,
--
Rowan Tommins
[IMSoP]
ported versions, so that code needing a particular version could check
for support directly, rather than having to attempt and catch an exception?
I guess in Larry's suggestion, that use case would be filled by
class_exists('JsonSchema_2026_10")
Regards,
--
Rowan Tommins
[IMSoP]
On 15 February 2023 05:18:50 GMT, Rowan Tommins wrote:
>My instinct was that it could just be a built-in class, with an internal
>pointer to a zend_string that's completely invisible to userland. Something
>like how the SimpleXML and DOM objects just point into a libxml parse result.
On 15 February 2023 02:35:42 GMT, Thomas Hruska wrote:
>On 2/14/2023 2:02 PM, Rowan Tommins wrote:
>I thought about that but didn't know how well it would be received nor,
>perhaps more importantly, the direction it should take (i.e. a formal Zend
>type in the engine, extending
cover at least some of these use cases.
C#, in particular, had a lot of very smart people paid to design it,
able to learn from mistakes Java had already made.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
l is indeed a valid value; but so is 0, and -1, and so
on. Why should the language assume that one default, among all the
possibilities, if you don't specify any?
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
b.com/derickr/timelib/pull/141#issuecomment-1386800720
>
Right, I missed that amongst the other comments. Which, again, is why I was
prompting you to clearly summarise the rationale for the change in one
place, to clear up any misunderstandings.
Regards,
--
Rowan Tommins
[IMSoP]
mes from my general opinion of backed enums -
to me, the opaque case object is primary, and the "value" is just an
arbitrary piece of data attached. I would have preferred to be able to
attach any number of such properties, e.g.
Options::verbose->longArgumentName, Options::verbose->shortArgumentName.
Regards,
--
Rowan Tommins
[IMSoP]
imes, technical violations of a spec are necessary for the
practical realities of the situation. I think you've answered this question
in the PR thread, but I'm trying to get the explanation all in one place,
because you've mentioned different details at different times.
Regards,
--
Rowan Tommins
[IMSoP]
c) The code you removed is *pointless in this particular case* because of a
combination of the C99 spec and other factors (but might be reasonable in
other circumstances)?
Regards,
--
Rowan Tommins
[IMSoP]
w.com/a/71235974/157957], you can get the case name the
same way, and use different arguments to array_column to get combinations
like a look up table from value to name:
$nameToValue = array_column(BackedEnum::cases(), 'name', 'value');
Regards,
--
Rowan Tommins
[IMSoP]
gotten.
Now that we have the Uninitialized state, and have deprecated dynamic
properties, this could mostly be reduced to two: has a current valid value, or
Uninitialized. But the details of what would need to change and when are the
subject for a future discussion.
Regards,
--
Rowan Tommins
[IM
erence, it
still matches array, as required by $mixed_list
// but do we also still know that it matches array?
It's all probably doable, but I think it's the other way around from your
initial statement: working out how to cache type checks would be a
pre-requisite for implementing local variable types.
Regards,
--
Rowan Tommins
[IMSoP]
rly a comment as far as the language
itself is concerned, so there is no expectation when reading it that it
will have a meaning to plain PHP.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
more efficient way, but it's not going to be a simple patch.
That's why including an official static analyser is tempting, but it's
not obvious where that would fit in the project and ecosystem (see the
recent thread on that topic).
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP R
book, but didn't gain traction outside it; I wish Saif luck
with Ara, but I'm not holding my breath.
[1] Yes, there's now a "class" keyword, but it's just syntactic sugar; the
fundamental inheritance model still consists of prototype chains.
--
Rowan Tommins
[IMSoP]
--
PHP Internals
ped with php-src, PECL is written in PHP, and there have
even been suggestions that rewriting some included functions in PHP would be a
good long-term goal.
The far larger concerns are governance, resources, and release cycles.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Dev
bly end up
with a lot of such cases - all the features that the Hack team decided
to remove - leading to poor performance and confusing developer experience.
I don't have a conclusion to this e-mail, I just thought I'd throw out
these thoughts.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Inter
mind,
parent::__get('name') is just a regular method call, so why does it
change the meaning of "calling scope"?
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
better naming, or better documentation of existing conventions.
- Perhaps it is a justification added when the include was first added. If so,
put it in the commit message and PR summary.
I'm not the right person to have opinions on the rest of this discussion, but I
can certainly understand the argument
to add
support for string increments to the += operator, and presumably also the +
operator to avoid a different inconsistency. That is, make 'a' + 5 === 'f'. I
don't think that's even worth considering, but it's the only other way to
achieve consistency.)
Regards,
--
Rowan Tommins
[IMSoP]
--
and
string_dec("0") could simply throw an Error.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
lf or :static which currently fails to
return would be a runtime error, but changing that error into an implicit
return $this could be very dangerous.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
he parameters a union "TextCollator|string
$collation", implying this:
// object is supported directly
$a->compareWith($b, (new TextCollator('en'))->setCaseInsensitive());
// so are strings if you already have one for some reason
$a->compareWith($b, 'en-u-ks-level1');
Regards,
--
Rowan Tommins
[IMSoP]
ng this
complexity to users in a class that otherwise holds their hand at
every step of the way? I think the parameters should always be a
user-friendly collation/locale object, with the ICU strings an
optional way for experts to create such an object.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
if people started using this for all the text on an application,
I can see longer strings becoming a more common use case.
Regards,
--
Rowan Tommins
[IMSoP]
really like to see, for instance, is a
grapheme-aware version of mb_strcut, to solve tasks like: "encode this
abstract Unicode string as UTF-16BE, truncated to at most 200 bytes,
without breaking apart any grapheme clusters".
Thanks again for getting the ball rolling, and I look fo
n possible solutions, not just
arguing in circles.
It's always been a source of confusion to me that JS has both, and the
syntax for working them seems far from elegant (unless things have
improved, and you no longer need to use typeof to detect undefined?);
but maybe I'm looking at it wrong.
Re
orm();
}
elseif ( trim($search) === '' ) {
show_validation_error();
}
else {
perform_search($search);
}
For cases where you don't need that distinction, Laravel, Symfony, and
CakePHP all allow a default to be passed as the second parameter.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP
the severity of one
specific message.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
effectively added the same notice to it as PHP has to built-in
functions, to track down where else this might be causing problems
without escalating to an error immediately.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https
ad to a
key being unexpectedly missing.
I think this is a general approach that should be more explicitly embraced:
introduce convenient syntax for valid use cases, while making accidents obvious.
Regards,
Hi Dan,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing Li
on this RFC as it is, so if some edge cases can reasonably be defined as
forbidden, we're less likely to end up regretting some detail.
Then if a good use case is identified, there can be a follow-up RFC,
either within this release cycle, or in a future release.
Regards,
--
Rowan Tommins
is RFC will let you do, and some that it *won't* let you do,
even for things that seem obvious to you, because they might not be obvious to
everyone.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
that invoking a separate method like
"setSomeProperty($blah)" from __clone() is allowed, or that it isn't?
Perhaps a couple of extra examples could be added to this section
demonstrating what would and wouldn't be allowed?
Regards,
--
Rowan Tommins
[IMSoP]
ed by a 1, but they are
certainly distinct values. I'd much rather get an error that made me check the
manual and find a flag than have one of them silently discarded.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
reasonable case for the choice of semantics, and I don't really
have a strong reason *not* to allow it.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
On 31/10/2022 10:16, Craig Francis wrote:
On Sun, 30 Oct 2022 at 17:42, Rowan Tommins
wrote:
In case of any confusion, I think this should be configurable as
"include microseconds: on / off", not configurable as "enter date
format".
Any reason it can't be c
conds: on / off", not configurable as "enter date format".
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
a user point of view I agree the feature would be useful. It would definitely
need to be behind an ini setting, though, to avoid existing log parsers failing
unexpectedly on the new format.
Regards,
Hi Mikhail,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailin
into:
fn() => [ 'dummy' => $dummy ]
which turns into:
function() use($dummy) { return [ 'dummy' => $dummy ]; }
Yes, that is what I meant by "it would be possible for the compiler to
special-case this scenario"; I explained why I think that would be a bad
idea, and suggested an
uld be named to be meaningful in the current scope, not somewhere
they're coming from or going to, but a dedicated syntax would at least
allow that flexibility.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
s to these questions, but it
would be helpful to understand people's gut feeling on them, to get a
better idea of what people are imagining.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
mpatible, but
then make users wait before using it in production.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
;123u" to say "u123" instead?
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
't support internationalized addresses in their
Unicode form, though, so it won't do for FILTER_FLAG_EMAIL_UNICODE.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
em that needs to be solved and there
are multiple solutions: GitHub issues, corporate/public messengers (Slack?) or
the internals mailing list.
There are certainly ways to approach it; I'm just agreeing with a
previous commenter that this would need to be an explicit part of any
proposal, n
entation
b) There is a better implementation out there, which we should start
using in ext/filter right now
My gut feel is that (a) is true, and there is no point considering what
a new function would be called, because we don't know how to implement it.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Inter
ith a shortage of experts, so I'm wary of adding more
complexity.
I also agree with the previous comment that this would need to be coupled
with some way of monitoring the results - imagine we released an
experimental feature 3 months ago, what do we do exactly to find out if it
needs changing?
Regards,
--
Rowan Tommins
[IMSoP]
implementations which would all be equally "valid"
according to some use case or opinion, so it's a bit of a quagmire.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
e whole of ext/filter and making a whole bunch
of new mistakes.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
time; if it exactly matches the delimiter,
stop; else, add the line to the file buffer. No actual parsing is required.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
licit in the sense that it is syntax dedicated for that
purpose, in a standard format. If I write <<way to know if "foo" is the name of a language I'm hoping to label, or
just a token which I know doesn't appear in my content; if I write /**
@lang foo */"hello", there's no am
On 19 September 2022 15:24:26 BST, "Olle Härstedt"
wrote:
>Hi internals!
>
>Some editors can guess the domain-specific language inside heredoc, e.g. if
>you do
>
>$query = <
d-process in another.
So, while it probably makes sense for all serialisation errors to consistently
throw, that should be planned for 9.0, and everything that's not already an
exception could raise a consistently formatted E_WARNING in 8.3.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals
s that like the Symfony example it is
"pretty-printing" existing JSON strings.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
your point, but those
three should probably be removed.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
int $mode = PHP_DIV_TRUNCATE): int
intmod(int $num1, int $num2, int $mode = PHP_DIV_TRUNCATE): int
Where $mode can also be PHP_DIV_FLOOR, and possibly additional
algorithms in future - the paper linked to on microsoft.com discusses
another three, and implies that there are many more.
Regards,
--
Rowan Tomm
; technique it gives "a meaningless result", but doesn't
actually illustrate that result, so I'm struggling to picture exactly
what each algorithm does.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
en written with
concurrent / asynchronous already "baked in", so are fully ready to take
advantage of it. If you need to rewrite large chunks of your codebase to
use an async-friendly framework anyway, it's less of a leap to switch
language completely.
Regards,
--
Rowan Tommins
[IMSo
->bar()->baz()" has the same "words" as "baz( bar( $foo ) )", just
in a different order.
I do agree that the left-to-right order is nicer to read than the nested
version, but that's largely opinion - it's not actually any shorter.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
extension methods higher priority will always be worse for
performance, because the lookups will happen more often. Giving them
lowest priority, just above throwing an error, is effectively free,
unless you're doing something very weird and care about the performance
of errors.
Regards,
ld suggest no, to keep things simpler.
(Aside: Reminder that convention on this list is to "bottom-post": quote the
part of message you're replying to, then add your text below.)
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
code
2. just before throwing a "method not found" error, loop over the list,
autoloading each entry if necessary; possibly at this point, errors would
be raised for naming conflicts and other violations
3. check each in-scope extension method in turn for an "instanceof" match
aga
towards
simplifying this - e.g. merge "typed" and "untyped" properties by making
"public $foo" equivalent to "public mixed $foo", which would remove the
distinction between "defined" and "initialized".
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
syntax choice is publicly
available, or if there's anyone with inside knowledge we could ask. It
would be good to know if there's a compelling argument the RFC could
mention, or if it was actually chosen for reasons that don't apply to PHP.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals
extra punctuation, and the
restriction that it comes before the normal visibility keyword:
class Foo {
#[PrivateSet] public static int|string $id;
}
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
uot; is that
accessing a property by reference is considered a "set" operation, which I'm
not sure how any implementation could avoid.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
lly tagged "Waiting on Author", but I have no way to
switch that back to "Waiting on Review" now that I've resolved the comments.
Thanks,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
unlikely that this change will make people suddenly use
traits in more "wrong" places, nor prevent any alternative horizontal
reuse / composition aid features being added in future.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscr
in the wrong way, or the wrong circumstances, and actually making their
code less secure.
Because of all of the above, I have cast a No vote, because I would
rather the right implementation was delayed until PHP 8.3 than the wrong
implementation rushed into PHP 8.2.
Regards,
--
Rowan Tommins
offers
neither opt-in nor opt-out, relying on the implementation to do the
right thing automatically ... most of the time.
To re-iterate, I am not opposed to the feature in principle, but would
have loved to see a more open exploration of different syntax options.
Regards,
--
Rowan Tommins
[IMSoP]
d what correct
usage looks like. Just providing a bunch of functions, in whatever form,
doesn't provide security unless users can understand how to use them
securely.
Regards,
--
Rowan Tommins
[IMSoP]
. The fact that a variable of the same name, whose
value is never actually used, is captured by the closure, is to me a
bug, not a feature.
It's hard to even contrive an example where this is observable, so I
highly doubt anyone is relying on it.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Inter