@Rowan Tommins
not saying this is a good idea or anything, but i just want to point
out that there's another way to do it in
7.4
$object = new class($foo, $foo * 2, $nextBaz) {
public int $foo;
public int $bar;
public int $baz;
public function __construct($foo, $bar, $baz) {
Den 2020-10-21 kl. 22:45, skrev Rowan Tommins:
On 21/10/2020 10:47, Pierre wrote:
I'd recommend that if your data is arbitrary, you can use arrays, if you
it's not, you probably always should write typed value objects
This is pretty much what I was going to say. If you have truly dynamic
ke
On 21/10/2020 10:47, Pierre wrote:
I'd recommend that if your data is arbitrary, you can use arrays, if you
it's not, you probably always should write typed value objects
This is pretty much what I was going to say. If you have truly dynamic
keys, then having the full set of array functions a
Le 21/10/2020 à 11:38, Björn Larsson a écrit :
>
> Well, but for us with a legacy code base where this is heavily used
> it would definitely be an improvement! It would enable a so called
> stepwise refinement :-)
>
> One typical usecase we have is populating an object with the result
> from a DB q
Den 2020-10-21 kl. 01:30, skrev Larry Garfield:
On Tue, Oct 20, 2020, at 5:53 PM, tyson andre wrote:
Hi internals,
e.g. `$x = object{key: object{'escaped-literal': $v2 }};`
(equivalent to `$x = (object)['key' => (object)['escaped-literal' => $v2]];`)
For example, in JS, non-string key literals
On Tue, Oct 20, 2020, at 5:53 PM, tyson andre wrote:
> Hi internals,
>
> e.g. `$x = object{key: object{'escaped-literal': $v2 }};`
> (equivalent to `$x = (object)['key' => (object)['escaped-literal' => $v2]];`)
>
> For example, in JS, non-string key literals are surrounded in `[]` to
> unambiguo
Hi internals,
e.g. `$x = object{key: object{'escaped-literal': $v2 }};`
(equivalent to `$x = (object)['key' => (object)['escaped-literal' => $v2]];`)
For example, in JS, non-string key literals are surrounded in `[]` to
unambiguously reference them.
Here, that could be `object{[$key]: $value, [M