I personally wish that'd be moved into the core standard simply because it's easier in a lot of cases (when you're doing offset + length instead of start/end). But I'm not really that opinionated over it.
----- Isiah Meadows [email protected] www.isiahmeadows.com On Fri, Oct 12, 2018 at 2:05 PM Peter Hoddie <[email protected]> wrote: > > we have `substr` and `slice` as well that do slightly different things with > slightly different names and there are valid use cases/simplification for > both string methods > > > substr is in Annex B for web compatibility. > > The specification notes: > > All of the language features and behaviours specified in this annex have one > or more undesirable characteristics and in the absence of legacy usage would > be removed from this specification > > And: > > These features are not considered part of the core ECMAScript language. > Programmers should not use or assume the existence of these features and > behaviours when writing new ECMAScript code. ECMAScript implementations are > discouraged from implementing these features unless the implementation is > part of a web browser or is required to run the same legacy ECMAScript code > that web browsers encounter. > > Our XS engine for emebdded followed this guidance: we didn't implement strstr > for a long time. Alas, developers from the web are so accustomed to having it > that we eventually gave in and provided it. Some conformance details here: > > https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/xs/XS%20Differences.md#conformance > > -- Peter > > On Oct 12, 2018, at 9:54 AM, Andrea Giammarchi <[email protected]> > wrote: > > I think having both `set` and `put` would be actually awesome, we have > `substr` and `slice` as well that do slightly different things with slightly > different names and there are valid use cases/simplification for both string > methods. > > AFAIK Allen mentioned it'd be awkward to have put too, but I hope others > agree it would solve most issues developers have with constants and one/off > WeakMap setups which is the most common use case with weak maps, weak sets, > and not weak counterparts. > > Regards > > On Fri, Oct 12, 2018 at 3:57 AM Jack Lu <[email protected]> wrote: >> >> It makes sense for a `put` to return the value, but it's awkward to say >> `put` when you want to get a value. >> And I'm fond of your proposal of `put`. > > _______________________________________________ > 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 _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

