Hi!
> Here's an RFC that would extend the syntax of list() to be more useful
> with associative arrays:
>
> https://wiki.php.net/rfc/list_keys
>
> Please read it and tell me your thoughts.
After reading the RFC, it looks like a great idea. I wouldn't exactly
encourage this for replacement of na
since I think this is rather out of scope.
>
> -Ursprüngliche Nachricht-
>> Von: Pierre Joye [mailto:pierre@gmail.com]
>> Gesendet: Montag, 18. Januar 2016 05:54
>> An: Andrea Faulds
>> Cc: PHP internals
>> Betreff: Re: [PHP-DEV] [RFC] Allow specif
Hi Andrea
I am writing you in private since I think this is rather out of scope.
-Ursprüngliche Nachricht-
> Von: Pierre Joye [mailto:pierre@gmail.com]
> Gesendet: Montag, 18. Januar 2016 05:54
> An: Andrea Faulds
> Cc: PHP internals
> Betreff: Re: [PHP-DEV] [RFC] A
Lester Caine wrote on 19/01/2016 11:49:
If we ever add object literals, then
>we could do object destructuring with a symmetrical syntax.
Andrea, please bare with me as I'm trying to work out just what some of
those long words actually mean.
I think what Andrea's getting at is being able to do
On 19 January 2016 at 02:20, Andrea Faulds wrote:
> After considering how to implement this at the opcode level, I've decided
> again that it's not worth it. Mixing keyed and unkeyed elements is not only
> an implementation nuisance (it's not necessarily hard, but it makes things
> more complicate
On 19/01/16 01:35, Andrea Faulds wrote:
>> $point = new Point(21, 42);
>> list('x' => $x, 'y' => $y) = $point;
>
> You can't do `$x = $point['x'];`, so `list("x" => $x) = $point;` won't
> work either. If you want list() support, implement ArrayAccess.
>
> We could potentially add some extension t
Hi again,
Andrea Faulds wrote:
How feasible would it be to add an exception to mixed keys? I'm thinking
list(7 => $a, $b, $c, $d) to specify an initial offset, similar to how
you
can define an array as [7 => 0, 1, 2, 3]. This obviously goes hand in
hand
with my desire for variable keys :)
Oh,
Hi Thomas,
Thomas Bley wrote:
What about using objects with list()?
class Point {
public function __construct($x, $y) {
$this->x = $x;
$this->y = $y;
}
}
$point = new Point(21, 42);
list('x' => $x, 'y' => $y) = $point;
You can't do `$x = $point['x'];`, so `list("x" => $x) = $point;` wo
Hi Leigh,
Leigh wrote:
The uses for this extended syntax go beyond simply populating object
properties, and shoehorning it into extract would pretty much limit it to
this use-case.
In fact I don't think extract() even works on object properties. list()
works with any "variable" (in the isse
> How feasible would it be to add an exception to mixed keys? I'm thinking
> list(7 => $a, $b, $c, $d) to specify an initial offset, similar to how you
> can define an array as [7 => 0, 1, 2, 3]. This obviously goes hand in hand
> with my desire for variable keys :)
I would like it to be like, des
What about using objects with list()?
class Point {
public function __construct($x, $y) {
$this->x = $x;
$this->y = $y;
}
}
$point = new Point(21, 42);
list('x' => $x, 'y' => $y) = $point;
Regards
Thomas
Andrea Faulds wrote on 17.01.2016 03:32:
> Hi everyone,
>
> Here's an RFC that would
On 18 January 2016 at 12:35, Lester Caine wrote:
> > Hi!
> >
> > I found the idea convincing from the first read, but maybe it's just my
> > mind's assumptions about list() that I dislike the resulting syntax,
> > yet, it seems to be the logical choice.
> >
> > So, maybe I'm just trying to say, t
Lester Caine wrote on 18/01/2016 12:35:
As someone still using 'extract' in legacy code, I can sort of see the
logistics of this, but why not just extend 'extract' to use the current
object rather than the symbol table. It already has handling for
duplicate keys and to prefix the 'array' name to
On 18/01/16 07:19, Michael Wallner wrote:
>> Here's an RFC that would extend the syntax of list() to be more useful
>> > with associative arrays:
>> >
>> > https://wiki.php.net/rfc/list_keys
>> >
>> > Please read it and tell me your thoughts.
> Hi!
>
> I found the idea convincing from the first
On 17/01/16 03:32, Andrea Faulds wrote:
> Hi everyone,
>
> Here's an RFC that would extend the syntax of list() to be more useful
> with associative arrays:
>
> https://wiki.php.net/rfc/list_keys
>
> Please read it and tell me your thoughts.
Hi!
I found the idea convincing from the first read,
hi Andrea,
I very much like this proposal. Good work as usual!
The only part where I think we should not rely on list is the future
scope. I can see the logic that leads to use list for named arguments.
However I really think it is a very different topic and having to use
list to define arguments
Hi Bishop,
Bishop Bettini wrote:
On Sat, Jan 16, 2016 at 9:32 PM, Andrea Faulds wrote:
Hi everyone,
Here's an RFC that would extend the syntax of list() to be more useful
with associative arrays:
https://wiki.php.net/rfc/list_keys
Please read it and tell me your thoughts.
Nice, Andrea,
On Sat, Jan 16, 2016 at 9:32 PM, Andrea Faulds wrote:
> Hi everyone,
>
> Here's an RFC that would extend the syntax of list() to be more useful
> with associative arrays:
>
> https://wiki.php.net/rfc/list_keys
>
> Please read it and tell me your thoughts.
>
Nice, Andrea, thanks! Destructuring is
Hi everyone,
Here's an RFC that would extend the syntax of list() to be more useful
with associative arrays:
https://wiki.php.net/rfc/list_keys
Please read it and tell me your thoughts.
Thanks!
--
Andrea Faulds
https://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsub
19 matches
Mail list logo