Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-11 Thread Dan Ackroyd
Rowan Tommins wrote: > I still don't follow this reasoning, for the reasons I outlined here: > ... > Whether "$foo . $bar" is always non-literal, or non-literal only if one > of its operands is, you're going to get an error about a non-literal > string somewhere else in the program, and have to t

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-11 Thread Dan Ackroyd
On Tue, 6 Jul 2021 at 10:32, Craig Francis wrote: > which will result in too many invalid errors, requiring them to make > substantial/unnecessary changes My understanding is that the majority of PHP developers use one of the many frameworks available. All of those provide libraries that people u

Re: [PHP-DEV] Type casting syntax

2021-07-11 Thread Eugene Sidelnyk
IMHO, This is suger which leads to diabetes. It adds pure implicitness without any payback. To convert object into something else add appropriate method. On Sat, Jul 10, 2021, 3:07 PM Marco Pivetta wrote: > Hey Max, > > On Sat, 10 Jul 2021, 11:09 Max Semenik, wrote: > > > I've been thinking abo

Re: [PHP-DEV] Type casting syntax

2021-07-11 Thread David Rodrigues
I really like the casting syntax, but I think it is difficult to be approved, at first, because there is already a "clearer" method for doing something like that. Which for me, particularly, does not invalidate an alternative. My suggestion is to create a magic method like __cast(AllowedTypes $in)

Re: [PHP-DEV] Type casting syntax

2021-07-11 Thread Levi Morrison via internals
I like Rust's From and TryFrom traits, which allow types to define conversions into or from other types. The From trait always succeeds, and TryFrom can fail. However, it's not a "cast" -- the user calls an `into`/`try_into` or `from`/`try_from` methods. I would be supportive of defining official

Re: [PHP-DEV] Type casting syntax

2021-07-11 Thread Larry Garfield
On Sun, Jul 11, 2021, at 5:30 PM, Levi Morrison via internals wrote: > I like Rust's From and TryFrom traits, which allow types to define > conversions into or from other types. The From trait always succeeds, > and TryFrom can fail. However, it's not a "cast" -- the user calls an > `into`/`try_int

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-11 Thread Craig Francis
On Sun, 11 Jul 2021 at 18:09, Dan Ackroyd wrote: > As I said in my reply to Rowan, making it easy to track down issues where > they occur, minimises the cost of using this feature over the years it > would be used. > This implementation allows you to do all of that. If you find debugging is a

Re: [PHP-DEV] Type casting syntax

2021-07-11 Thread Mike Schinkel
> On Jul 11, 2021, at 7:19 PM, Larry Garfield wrote: > > What are the use cases for integrated object to object (ie, class to class) > conversion in PHP? > I'm not entirely clear on what the use case is in PHP. When would that be > superior to "just write an asFoo() method and move on with