Observing whether a function is strict

Isiah Meadows isiahmeadows at gmail.com
Thu May 26 09:16:19 UTC 2016


I would be mostly okay if sloppy mode goes away. The only use case I have
now for it is for accessing the global in a platform independent manner,
but the System.global proposal eliminates this need. I write all code in
strict mode now, so I only see likely performance benefits from completely
ditching sloppy. Also, ES6 modules are in strict mode.

As for code generation, which some libraries use, they'll probably the the
most affected. Template libraries usually use `with` statements in sloppy
mode to simplify the work in creating the functions. The only other methods
are to either restrict the format of the interpolations or require/assume
an argument with a specific name.

On Thu, May 26, 2016, 04:43 G. Kay Lee <
balancetraveller+es-discuss at gmail.com> wrote:

> I was under the impression that strict mode is a (temporary) workaround to
> get rid of unwanted bad parts of the language without instantly breaking
> anything. The long term question thus should be: do we have a timeline on
> the final removal of non-strict behavior from the language, and establish
> the "strict mode" as the one and only standard behavior. If so, then
> introducing any additional language feature to help detecting
> strict/non-strict is certainly not ideal.
>
> As a side note - if we're gonna have Traits in ES I'd really like to see
> something like Scala's `class CollegeStudent extends Student with Worker
> with Underpaid with Young`, but the valuable `with` keyword is currently
> occupied by a phantom from the language's rugged past. I'd really like to
> see these ghosts from the past being removed from the spec once and for all
> instead of being hidden behind some doors with a "DONT TOUCH" sign on it.
>
>
>
> On Thu, May 26, 2016 at 4:06 PM, Claude Pache <claude.pache at gmail.com>
> wrote:
>
>>
>> > Le 26 mai 2016 à 09:57, Mathias Bynens <mathiasb at opera.com> a écrit :
>> >
>> > On Thu, May 26, 2016 at 9:48 AM, Claude Pache <claude.pache at gmail.com>
>> wrote:
>> >> I was wondering whether there is a way to observe whether a given
>> random function is strict (or sloppy, or neither).
>> >> […] Are there other ways? (If not, I find it somewhat unfortunate that
>> only such nonstandard features leak this information.)
>> >
>> > I smell a proposal for `Reflect.isStrict` in the making…
>>
>> (To be clear, I would be strongly opposed to such a proposal: Being
>> strict or not is an implementation detail that the consumer need not know.)
>>
>> —Claude
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160526/fa1bb631/attachment.html>


More information about the es-discuss mailing list