Also, it's not like you can't emulate this at the language level:

```js
function setIn(object, path, value) {
    return path.slice(0, -1)
        .reduce((o, p) => o[p], object)
        [path[path.length - 1]] = value
}

const gpi = setIn(object, ["basenet", "supernet"],
    new Network().typeOf({ starTopology: [[0, 1, ..], [2, 3, ..],..] })
)
```

Lodash has a variant of this in its [`_.set`][1] method, which returns
the object rather than the operand. The equivalent to that would be
this:

```js
const gpi = new Network().typeOf({ starTopology: [[0, 1, ..], [2, 3, ..],..] })

_.set(object, "basenet.supernet", gpi)
```

[1]: https://lodash.com/docs#set

-----

Isiah Meadows
[email protected]
www.isiahmeadows.com

On Tue, May 8, 2018 at 9:41 AM, T.J. Crowder
<[email protected]> wrote:
>
> What specific advantages do you see this new syntax bringing compared to, say:
>
> ```js
> var gpi = new Network().typeOf({ starTopology:[[0,1,..],[2,3,..],..] });
> var theorem = [ "basenet": [ "supernet": gpi ] ];
> ```
>
> ...or with a sneaky assignment:
>
> ```js
> var gpi, theorem = [ "basenet": [ "supernet": gpi = new Network().typeOf({ 
> starTopology:[[0,1,..],[2,3,..],..] }) ] ];
> ```
>
> ...which do the same thing?
>
> Does this call on any prior art?
>
> What problems does it solve?
>
> -- T.J. Crowder
>
> On Tue, May 8, 2018 at 10:53 AM, Abdul Shabazz
> <[email protected]> wrote:
> > I would like to see a standard way of inlining javascript.
> >
> > For example:
> >
> > gpi <= theorem => basenet => supernet <= new Network().typeOf({
> > starTopology:[[0,1,..],[2,3,..],..] }),
> >
> > is syntactic sugar for:
> >
> > var theorem = [];
> > theorem["basenet"] = [];
> > theorem["basenet"]["supernet"] = new Network().typeOf({
> > starTopology:[[0,1,..],[2,3,..],..] });
> > var gpi = theorem["basenet"]["supernet"];
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to