Re: [PHP-DEV] One-line heredoc for better syntax highlightning

2022-09-20 Thread Rowan Tommins
line at a 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

Re: [PHP-DEV] Sanitize filters

2022-10-03 Thread Rowan Tommins
implementing the 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

Re: [PHP-DEV] Sanitize filters

2022-10-04 Thread Rowan Tommins
o integer" could have a dozen different 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

Re: [PHP-DEV] Experimental features

2022-10-05 Thread Rowan Tommins
with 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]

Re: [PHP-DEV] Union type casts

2022-10-05 Thread Rowan Tommins
t recently, and it gets complicated quickly. Regards, -- Rowan Tommins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Sanitize filters

2022-10-06 Thread Rowan Tommins
sed on the same implementation 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,

Re: [PHP-DEV] Experimental features

2022-10-06 Thread Rowan Tommins
that is a problem 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

Re: [PHP-DEV] Sanitize filters

2022-10-06 Thread Rowan Tommins
t it doesn'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

Re: [PHP-DEV] Experimental features

2022-10-06 Thread Rowan Tommins
ce all my "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

Re: [PHP-DEV] Experimental features

2022-10-08 Thread Rowan Tommins
hanges to other extensions to be compatible, 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

Re: [PHP-DEV] Experimental features

2022-10-11 Thread Rowan Tommins
to have final answers 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

Re: [PHP-DEV] Compact can't resolve outer scoped variables using short closures

2022-10-20 Thread Rowan Tommins
Nikita's RFC linked above $x = [ :$foo, bar: someFunc() ]; I'm personally not a fan of this coding style, because I think variables should 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

Re: [PHP-DEV] Compact can't resolve outer scoped variables using short closures

2022-10-20 Thread Rowan Tommins
my') turns 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 wou

Re: [PHP-DEV] Microseconds to error log

2022-10-21 Thread Rowan Tommins
rom 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 Mail

Re: [PHP-DEV] Microseconds to error log

2022-10-30 Thread Rowan Tommins
econds: 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

Re: [PHP-DEV] Microseconds to error log

2022-10-31 Thread Rowan Tommins
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

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-01 Thread Rowan Tommins
eyed, but you make a 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

Re: [PHP-DEV] ARRAY_UNIQUE_IDENTICAL option

2022-11-04 Thread Rowan Tommins
backed 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

Re: [PHP-DEV] [RFC] [Discussion] Readonly class amendments

2022-11-15 Thread Rowan Tommins
saying 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]

Re: [PHP-DEV] [RFC] [Discussion] Readonly class amendments

2022-11-15 Thread Rowan Tommins
things this 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

Re: [PHP-DEV] [RFC] Asymmetric Visibility, with readonly

2022-11-21 Thread Rowan Tommins
and agree 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, -

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-12 Thread Rowan Tommins
a key might be missing, while giving them useful feedback for typos and other mistakes that lead 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. Re

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Rowan Tommins
ther than NULL, leading to data corruption. I have 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 Dev

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Rowan Tommins
etting to change 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

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Rowan Tommins
g. if ( $search === null ) {     render_search_form(); } 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

Re: [PHP-DEV] Revisiting RFC: Engine Warnings -- Undefined array index

2022-12-13 Thread Rowan Tommins
eep the focus on 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

Re: [PHP-DEV] [RFC] Unicode Text Processing

2022-12-15 Thread Rowan Tommins
odepoints) is essential. One function that I would 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". T

Re: [PHP-DEV] [RFC] Unicode Text Processing

2022-12-16 Thread Rowan Tommins
s, I don't know, but 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]

Re: [PHP-DEV] [RFC] Unicode Text Processing

2022-12-16 Thread Rowan Tommins
ink that's a bad sign - why are we exposing 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

Re: [PHP-DEV] [RFC] Unicode Text Processing

2022-12-21 Thread Rowan Tommins
nly a way of getting an object $a->compareWith($b, TextCollator::fromCollationString('en-u-ks-level1')); A third option would be to make the 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]

Re: [PHP-DEV] Methods which auto-return the class instance

2022-12-24 Thread Rowan Tommins
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

Re: [PHP-DEV] [RFC] Path to Saner Increment/Decrement operators

2023-01-17 Thread Rowan Tommins
(""), 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

Re: [PHP-DEV] [RFC] Path to Saner Increment/Decrement operators

2023-01-18 Thread Rowan Tommins
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.) Regar

Re: [PHP-DEV] RFC: rules for #include directives

2023-01-18 Thread Rowan Tommins
ude it. If so, concentrate on 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 ca

Re: [PHP-DEV] [RFC] Pass Scope to Magic Accessors

2023-01-24 Thread Rowan Tommins
n't understand why. In my 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

Re: [PHP-DEV] Official Preprocessor

2023-02-02 Thread Rowan Tommins
ness. The approach seems appealing, but PHP would probably 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 t

Re: [PHP-DEV] Official Preprocessor

2023-02-03 Thread Rowan Tommins
in PHP and shipped 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 -

Re: [PHP-DEV] Official Preprocessor

2023-02-04 Thread Rowan Tommins
ing inside Facebook, 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. -- Rowa

Re: [PHP-DEV] RFC Proposal - Types for Inline Variables

2023-02-07 Thread Rowan Tommins
plement checks in a 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 Tommin

Re: [PHP-DEV] RFC Proposal - Types for Inline Variables

2023-02-07 Thread Rowan Tommins
t; syntax is clearly 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

Re: [PHP-DEV] RFC Proposal - Types for Inline Variables

2023-02-08 Thread Rowan Tommins
y or knowing that it matches array // as a minimum, we need to assert that after modifying it by reference, 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]

Re: [PHP-DEV] 'Uninitialized' creates a lot of cluttering

2023-02-08 Thread Rowan Tommins
x27;ve forgotten. 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, -- Ro

Re: [PHP-DEV] RFC proposal: values getter in BackedEnum

2023-02-09 Thread Rowan Tommins
https://stackoverflow.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]

Re: [PHP-DEV] How to deal with bugs in vendored libraries?

2023-02-09 Thread Rowan Tommins
es not violate it)? 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]

Re: [PHP-DEV] How to deal with bugs in vendored libraries?

2023-02-09 Thread Rowan Tommins
: what gives you confidence that the change is *safe*? Sometimes, 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]

Re: [PHP-DEV] RFC proposal: values getter in BackedEnum

2023-02-09 Thread Rowan Tommins
his probably comes 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]

Re: [PHP-DEV] How to deal with bugs in vendored libraries?

2023-02-09 Thread Rowan Tommins
github.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]

Re: [PHP-DEV] 'Uninitialized' creates a lot of cluttering

2023-02-12 Thread Rowan Tommins
pe of ?int, null 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

Re: [PHP-DEV] [RFC] Working With Substrings

2023-02-14 Thread Rowan Tommins
ver 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

Re: [PHP-DEV] [RFC] Working With Substrings

2023-02-14 Thread Rowan Tommins
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, exten

Re: [PHP-DEV] [RFC] Working With Substrings

2023-02-14 Thread Rowan Tommins
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 re

Re: [PHP-DEV] RFC Idea - json_validate() validate schema

2023-03-02 Thread Rowan Tommins
t it would look like in this case, but may be worth considering. Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] RFC Idea - json_validate() validate schema

2023-03-02 Thread Rowan Tommins
ts the supported 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]

Re: [PHP-DEV] RFC Idea - json_validate() validate schema

2023-03-03 Thread Rowan Tommins
On 3 March 2023 16:30:26 GMT, Larry Garfield wrote: >Class constants FTW. s/Class constants/enum/ :P -- Rowan Tommins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] First-class callable partial application

2023-03-13 Thread Rowan Tommins
This is definitely one 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]

Re: [PHP-DEV] First-class callable partial application

2023-03-13 Thread Rowan Tommins
I don't want to 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

Re: [PHP-DEV] First-class callable partial application

2023-03-14 Thread Rowan Tommins
['allowed_classes' => false]); $isLogger = 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

Re: [PHP-DEV] First-class callable partial application

2023-03-14 Thread Rowan Tommins
= number_format(?, 2, ',', '.'); $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]

[PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-14 Thread Rowan Tommins
les and thoughts 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 Ru

Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-14 Thread Rowan Tommins
ecause I'd really love for anonymous classes to be more flexible than they are. Regards, -- Rowan Tommins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-14 Thread Rowan Tommins
anything, 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

Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-15 Thread Rowan Tommins
if it's possible 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

Re: [PHP-DEV] First-class callable partial application

2023-03-16 Thread Rowan Tommins
y_map($foo, $array); $filterFoo = fn($array) => array_filter($array, $foo); Regards, -- Rowan Tommins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-16 Thread Rowan Tommins
ion __construct(int $counter, string $name) { $this->counter = $counter; $this->name = $name; } } Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-16 Thread Rowan Tommins
al functionality 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

Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-16 Thread Rowan Tommins
uctor, the compiler 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

Re: [PHP-DEV] First-class callable partial application

2023-03-17 Thread Rowan Tommins
example would become something like: $size = Closure::apply( Closure::pipe( Closure::partial(amap(...), chr(...)), Closure::partial( implode (...), ','), amap(...) ), $arr ); Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [IDEA] allow extending enum

2023-03-29 Thread Rowan Tommins
keyword to make clear that this is *not* a sub-type relationship - perhaps something like "expands", "allows", or "encompasses". Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [IDEA] allow extending enum

2023-03-29 Thread Rowan Tommins
// handling for new code goes here break; default: // assert($code instanceof StandardErrorCode); parent::handle($code); break; } } } Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [IDEA] allow extending enum

2023-03-29 Thread Rowan Tommins
pe it 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]

Re: [PHP-DEV] Mailing List Preferences (was: Broken Wiki Registraiton)

2023-03-30 Thread Rowan Tommins
web UI for long threads). But on the other hand, you can't predict how your messages will interact with someone else's UI and workflow. Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] Broken Wiki Registraiton (was: [IDEA] allow extending enum)

2023-03-30 Thread Rowan Tommins
an deciding when to *remove* you. Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] Property Hooks Discussion

2023-03-31 Thread Rowan Tommins
ot;Draft" 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]

Re: [PHP-DEV] [DISCUSSION] C++ Enhancements in Zend API

2024-08-14 Thread Rowan Tommins [IMSoP]
even add C++ (or Rust, Go, etc) APIs for already released versions of the engine. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] function autoloading v4 RFC

2024-08-15 Thread Rowan Tommins [IMSoP]
open RFC implementing option (b) by Gina and Dan here: https://wiki.php.net/rfc/core-autoloading Last I heard, Gina was still hoping to get back to it. On a different note, there is no mention of autoloading namespaced constants in this RFC, unlike in some previous proposals. Is this a conscious decision to leave them out of scope, or an oversight? Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Rowan Tommins [IMSoP]
ding >Unicode into the standard library? I was just summarising the current situation, to work out where we could go next. Any attempt to extend string handling functionality is likely to build on either ext/intl or ext/mbstring, so it's useful to understand how they differ. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Rowan Tommins [IMSoP]
ass that tries to "do Unicode" makes sense; it would be like having a "maths class" that contains methods for anything dealing with numbers. In fact, I think the group of functions you're suggesting are a great illustration of what I was saying in my last message to Rob: they make perfect sense as standalone features, and don't need any grand plan to "have Unicode in core" before we proceed with them. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Rowan Tommins [IMSoP]
t how Unicode works, but ideally we want to find meaningful abstractions of those technicalities, not just require every user to understand them. (PS I think I accidentally called you Rob just now; sorry!) Rowan Tommins [IMSoP]

Re: [PHP-DEV] String enums & __toString()

2024-08-17 Thread Rowan Tommins [IMSoP]
trings for backward compatibility, and have this: function fooThatTakesAnOption(FooOptionEnum|string $opt) { if ( is_string($opt) ) { $opt = FooOptionEnum::from($opt); } ... } You might later want to use $opt->value, or $opt->getApiRepresentation(), or whatever else; but at that point you know you have an object of a particular type. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] String enums & __toString()

2024-08-17 Thread Rowan Tommins [IMSoP]
tringable are a good idea, so I guess I'll just leave y'all to it. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] function autoloading v4 RFC

2024-08-17 Thread Rowan Tommins [IMSoP]
isting userland functions with that name. Between that and obviously serious BC breaks like *removing* a function, there's a big grey area where we have to make a judgement call. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-18 Thread Rowan Tommins [IMSoP]
;" but it probably wouldn't feel very natural. It would be a syntax error to write "include($path, $whatever)" just as "echo $foo, $bar" is valid, but "echo($foo, $bar)" is not. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] function autoloading v4 RFC

2024-08-19 Thread Rowan Tommins [IMSoP]
the same name. Proposing both at once seems reasonable, as the autoloading gives an extra benefit to outweigh the breaking change to shadowing behaviour. Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] function autoloading v4 RFC

2024-08-19 Thread Rowan Tommins [IMSoP]
That's not a small detail of the implementation, it's a really fundamental difference from previous proposals. So I would like to repeat my first response to your RFC: that it should sound more time explaining your approach to the multiple lookup problem. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-22 Thread Rowan Tommins [IMSoP]
ns local" in PHP 5.3, and we'd all be used to writing "\strlen" by now; but "unqualified means global" feels much more achievable from where we are. -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-22 Thread Rowan Tommins [IMSoP]
ing a function in one namespace is currently a lot easier than setting up such a rewriter; but I don't think we should let that convenience for a few use cases outweigh the benefits in performance that a change in behaviour could bring, particularly when combined with function autoloading. -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
r option would be to find a shorter keyword than "namespace" to put it in front. "ns\strlen(...)" is an obvious step from what we have currently, but it's not very obvious what it means, so maybe there's a different word we could use. Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
7;t seem mutually exclusive to me. If you have a file where you've opted for "using global functions", you might want a way to reference a function in the current namespace. It also doesn't address my other point, that having global as the default mode (even if we provide an option for local) is much less disruptive to existing code. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
t would behave in exactly the same way that "namespace\Foo" already does. -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
in any way by any of the proposals in this thread: namespace Acme\Foo\Controller; use function Acme\StringUtils\better_strlen; use Acme\StandardUtils as Std; $foo = Std\generate_something(); $len = better_strlen($foo); \Acme\Debug\out($len); Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
ace Acme\Foo\Utils; function magic(string $x): int { return \strlen($x); } function more_magic(string $x): int { return magic($x) * 2; } Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
rent syntax, rather long and unclear return _\strlen("Hello World"); # short, but maybe a bit cryptic return Text\strlen("Hello World"); # variable length, relies on current context return NS\strlen("Hello World"); # shortening of current keyword return self\strlen("Hello World"); # maybe confusing to reuse a keyword? return current\strlen("Hello World"); # clear, but a bit long -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
context where a relative name would be assumed. For example, \\domain\username and \\server\fileshare on Windows, or //example.com/foo in a URL Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
On Fri, 23 Aug 2024, at 13:45, Mike Schinkel wrote: >> On Aug 23, 2024, at 8:33 AM, Rowan Tommins [IMSoP] >> wrote: >> On 23 August 2024 13:04:22 BST, Mike Schinkel wrote: >>> And how can it occur without an explicit `use >>> AcmeComponents\SplineReticu

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
mean classes and functions resolve differently, and that's why I said that if I had a time machine, I would support a different option. But, personally, I don't think the small long-term inconsistency outweighs the huge short-term disruption of defaulting to local. Regards, -- Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
leaving some inconsistency, but less compatibility break. And most users don't object to using a leading backslash, they just (quite reasonably) have no idea what impact it has on the ability of the engine to optimise their code. Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
t;, and avoid them, why wouldn't we? Your answer to that seems to be that you think "global only" is a bigger BC break, but I wonder how much difference it really makes. As in, how many codebases are using unqualified calls to reference a namespaced function, but *not* shadowing a global name? Regards, Rowan Tommins [IMSoP]

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-23 Thread Rowan Tommins [IMSoP]
On 23 August 2024 20:50:05 BST, Rob Landers wrote: >If it were global only, then how would I call those files? >namespace\read_and_process_file()? See my earlier posts, particularly https://externals.io/message/124718#125098 and https://externals.io/message/124718#125125 Rowan T

Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local)

2024-08-24 Thread Rowan Tommins [IMSoP]
self: I agree that option 3 is the ideal in theory, but in practice the short/medium term impact is so big, I'm not convinced it's worth it for the long term gain. Rowan Tommins [IMSoP]

Re: [PHP-DEV] [RFC] Default expression

2024-08-25 Thread Rowan Tommins [IMSoP]
ther "conditions with default on the RHS" in my shortlist above fit the same basic use case Beyond that, I'm struggling to think of meaningful uses: "whatever the function sets as its default, do the opposite"; "whatever number the function sets as default, raise it to the power of 3"; etc. Again, they can easily be added in later versions, if a use case is pointed out. Regards, -- Rowan Tommins [IMSoP]

<    5   6   7   8   9   10   11   12   >