Operator overloading for non-value objects

Tristan Zajonc tristan at senseplatform.com
Wed Jan 15 16:17:44 PST 2014


Continuing the tangent.  There are lots of other use cases for operator
overloading with mutable objects.  On this list, I previously discussed the
desire for operator overloading on large mutable matrices.  The lack of
operator overloading is the biggest syntax annoyance for building numerics
libraries in JS. I actually don't have much need for all new numeric value
types or literal syntax, but that's just me.

I also pushed a bit for additional operators, to support
elementwise/objectwise manipulation of matrices ala Matlab/Julia. The
conclusion was that a colon postfix might be feasible:  a +: b.  I
understand this may not be of interest to traditional users of JavaScript,
but it would make it possible to have really beautiful numerics libraries
and perhaps should be considered. See the thread "elementwise operators"
for the rationale, with reference to PEP225 (
http://www.python.org/dev/peps/pep-0225/).

Tristan

---
Tristan Zajonc, PhD | Cofounder/CEO at Sense <https://senseplatform.com> |
https://senseplatform.com | @tristanzajonc<https://twitter.com/tristanzajonc>



On Wed, Jan 15, 2014 at 1:50 AM, Anne van Kesteren <annevk at annevk.nl> wrote:

> On Wed, Jan 15, 2014 at 7:35 AM, Sebastian Markbåge
> <sebastian at calyptus.eu> wrote:
> > At risk of derailing the conversation with a tangent... I don't
> understand
> > the premise. Why is it so important that URLs are mutable? (Other than
> > already being drafted that way.)
>
> That's a good question. I mostly took after <a> / Location and what
> existing URL libraries offered, and nobody has questioned that design
> much to date. It is implemented now in Firefox/Chrome though.
>
> URLSearchParams is mutable and that's definitely desired. So if we
> still want to expose equivalent functionality we'd have to provide a
> readonly variant of that.
>
> We could at some point provide a URLValue API maybe for immutable URLs
> (and have operator overloading).
>
>
> --
> http://annevankesteren.nl/
> _______________________________________________
> 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/20140115/251fd976/attachment-0001.html>


More information about the es-discuss mailing list