Strict Relational Operators

Michael J. Ryan tracker1 at gmail.com
Wed Apr 12 06:05:17 UTC 2017


Thinking on it... (Number|Object|String) .strict(Equal|Greater|Less...)
Methods (a, b) might be better...  If either value isn't a match for the
bound type, it's a false, even if both sides are equal...

Ex,.

Number.strictEqual(null, null)  false

Object.strictEqual(1, 1)  false
...

If you're doing a strict compare, one can presume you should know what
you're comparing.


-- 
Michael J. Ryan - tracker1 at gmail.com - http://tracker1.info

Please excuse grammar errors and typos, as this message was sent from my
phone.

On Apr 11, 2017 10:46 PM, "felix" <felix8a at gmail.com> wrote:

> Maybe every operator can have a non-coercing variant?
>
> One possible syntax is to have a modifier on operators
>     x = a (<) b (+) c (&&) (!)d;
>     if (x (!=) y) ...
>
> Another possible syntax is to have a modifier on expressions
>     x = #(a < b + c && !d)
>     if #(x != y) ...
>
> On Tue, Apr 11, 2017 at 7:48 PM, Darien Valentine <valentinium at gmail.com>
> wrote:
> > Although I’m unsure if this is wise given there are already eleven
> symbols
> > that are combinations of `=` and `<`/`>`, for symmetry with `==` and
> `===`
> > I’d imagine something like this:
> >
> > ```
> > COERCIVE  STRICT
> >>         =>=
> > <         =<=
> >>=        =>==
> > <=        =<==
> > ```
> >
> > Could also follow the pattern `>==` (strict GT) and `<===` (strict GTE),
> > which avoids the awkwardness of the latter two sharing opening chars with
> > `=>`, but that seems more ambiguous since `>==` doesn’t let you infer
> > whether it means strict GT or strict GTE.
> >
> > It’d be nice to have this functionality built in, but I wonder if it’d
> > possibly be preferable to provide it through methods of one of the
> built-in
> > objects, rather than as operators. Functions after all are more flexible.
> >
> > _______________________________________________
> > 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/20170411/0717d9b9/attachment-0001.html>


More information about the es-discuss mailing list