Re: [PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Ilija Tovilo
Hi Rowan On Tue, Mar 19, 2024 at 8:39 PM Rowan Tommins [IMSoP] wrote: > > As well pattern matching, which Ilija mentioned, another adjacent feature is > a richer set of casting operators. Currently, we can assert that something is > an int; or we can force it to be an int; but we can't easily

Re: [PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Rowan Tommins [IMSoP]
On 19/03/2024 16:24, Robert Landers wrote: $x = $attributeReflection->newInstance() as ?MyAttribute; if ($x === null) // do something since the attribute isn't MyAttribute I think reusing nullability for this would be a mistake - ideally, the right-hand side should allow any type, so "$foo

Re: [PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Ilija Tovilo
Hi Marco On Tue, Mar 19, 2024 at 7:04 PM Marco Aurélio Deleu wrote: > > > On 19 Mar 2024, at 14:51, Ilija Tovilo wrote: > > > > Hi Robert > > > >> On Tue, Mar 19, 2024 at 5:24 PM Robert Landers > >> wrote: > >> > > See https://wiki.php.net/rfc/pattern-matching#throwing_alternative. I > >

Re: [PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Marco Aurélio Deleu
Marco Deleu > On 19 Mar 2024, at 14:51, Ilija Tovilo wrote: > > Hi Robert > >> On Tue, Mar 19, 2024 at 5:24 PM Robert Landers >> wrote: >> >> I've been thinking about this as an RFC for awhile, but with generics >> being far off (if at all), I'd like to propose a useful idea: reusing >>

Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2

2024-03-19 Thread Larry Garfield
On Tue, Mar 19, 2024, at 11:16 AM, Derick Rethans wrote: > On Fri, 8 Mar 2024, Larry Garfield wrote: > >> Hi folks. Based on earlier discussions, we've made a number of >> changes to the RFC that should address some of the concerns people >> raised. We also had some very fruitful discussions

Re: [PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Marco Pivetta
On Tue, 19 Mar 2024 at 17:46, Deleu wrote: > On Tue, Mar 19, 2024 at 1:42 PM Marco Pivetta wrote: > >> One note: if what you are going for is what `azjezz/psl`, be aware that >> exception / error tracing design needs special attention here: it's not as >> simple as it looks! >> > > I believe

Re: [PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Ilija Tovilo
Hi Robert On Tue, Mar 19, 2024 at 5:24 PM Robert Landers wrote: > > I've been thinking about this as an RFC for awhile, but with generics > being far off (if at all), I'd like to propose a useful idea: reusing > the AS keyword in a different context. > > Example: > > $x =

Re: [PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Deleu
On Tue, Mar 19, 2024 at 1:42 PM Marco Pivetta wrote: > One note: if what you are going for is what `azjezz/psl`, be aware that > exception / error tracing design needs special attention here: it's not as > simple as it looks! > I believe you answered your own question here. The proposal seems

Re: [PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Marco Pivetta
Hey Robert, On Tue, 19 Mar 2024 at 17:24, Robert Landers wrote: > Hello internals, > > I've been thinking about this as an RFC for awhile, but with generics > being far off (if at all), I'd like to propose a useful idea: reusing > the AS keyword in a different context. > > Example: > > $x =

[PHP-DEV] Proposal: AS assertions

2024-03-19 Thread Robert Landers
Hello internals, I've been thinking about this as an RFC for awhile, but with generics being far off (if at all), I'd like to propose a useful idea: reusing the AS keyword in a different context. Example: $x = $attributeReflection->newInstance() as MyAttribute; This would essentially perform

Re: [PHP-DEV] Supporting object types in BCMath

2024-03-19 Thread Saki Takamachi
Hi Jordan, > I've done a lot of performance tuning on my arbitrary precision library, and > will simply state for everyone here that I think the amount of development > effort involved in improving performance of the BCMath library is almost > certainly going to see a return on your effort

Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2

2024-03-19 Thread Derick Rethans
On Fri, 8 Mar 2024, Larry Garfield wrote: > Hi folks. Based on earlier discussions, we've made a number of > changes to the RFC that should address some of the concerns people > raised. We also had some very fruitful discussions off-list with > several developers from the Foundation, which