<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>mst</author><text>The solution I&amp;#x27;ve been playing with for $interp_thing (mostly in my head so far) is roughly the python version but with some type dispatch checking to pick the &amp;quot;most specific&amp;quot; of the two - which is easy when one is a subclass of the other but gets gribbly in more complicated cases. I &lt;i&gt;suspect&lt;/i&gt; ultimately it&amp;#x27;ll be a case of &amp;quot;run a multimethod style selection algorithm for &amp;#x27;most specific&amp;#x27; and arbitrarily declare &amp;#x27;LHS wins&amp;#x27;&amp;quot; but I&amp;#x27;ve not got far enough to consider that remotely fully baked.&lt;p&gt;($interp_thing being a placeholder for something I&amp;#x27;m experimenting with of late)</text><parent_chain><item><author>xscott</author><text>Wren seems like a really clean alternative to a language like Python, but it makes one mistake that really drives me nuts.  In order to provide binary operators, you must implement a method on the left object.  From the documentation [0]:&lt;p&gt;&amp;gt; The left operand is the receiver, and the right operand gets passed to it. So a + b is semantically interpreted as “invoke the +(_) method on a, passing it b“.&lt;p&gt;This means that if you want to implement complex numbers, or matrices, or a bunch of other useful stuff, you&amp;#x27;d have to be able to extend the type on the left (which you didn&amp;#x27;t write).  You really want to be able to do things like:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    var z = Complex.new(1.0, 2.0)
    var result = 3.0 - z

    var A = Matrix.ident(3, 3)
    var scaled = 4.0*A
&lt;/code&gt;&lt;/pre&gt;
Python hacks around this by having &amp;quot;right&amp;#x27; versions of these methods too.  It&amp;#x27;s kind of ugly - if the left object fails to support the operator method (__sub__ or __mul__) with the right type, the interpreter looks for a __rsub__ or __rmul__ operator on the right object to try.  Ugly, but it works.&lt;p&gt;C++ works around this a much better way:  You can either have the operator method on the left object, or have an overloaded operator function that isn&amp;#x27;t tied to either object.&lt;p&gt;Rust puts the operators on the left object too, but in some cases you &lt;i&gt;can&lt;/i&gt; add methods&amp;#x2F;trait specializations to left classes.  Unfortunately, Rust doesn&amp;#x27;t let you do this with generics, but that&amp;#x27;s a longer more complicated topic.&lt;p&gt;Maybe there&amp;#x27;s some way Wren lets you tack on additional methods to the builtin Num class (monkey patching), but I couldn&amp;#x27;t find it.  I would love an elegant alternative to Python, but this is enough of an issue that it keeps me from using Wren.&lt;p&gt;[0] - &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;wren.io&amp;#x2F;method-calls.html#operators&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;wren.io&amp;#x2F;method-calls.html#operators&lt;/a&gt;</text></item></parent_chain></comment><story><title>Wren is a small, fast, class-based concurrent scripting language</title><url>https://wren.io/</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>byroot</author><text>You also have the Ruby solution of calling a `coerce` [0] method on the right hand side.&lt;p&gt;[0] - &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;ruby&amp;#x2F;ruby&amp;#x2F;blob&amp;#x2F;0703e014713ae92f4c8a2b31e385718dc2452eac&amp;#x2F;lib&amp;#x2F;matrix.rb#L1589-L1602&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;ruby&amp;#x2F;ruby&amp;#x2F;blob&amp;#x2F;0703e014713ae92f4c8a2b31e3...&lt;/a&gt;</text><parent_chain><item><author>xscott</author><text>Wren seems like a really clean alternative to a language like Python, but it makes one mistake that really drives me nuts.  In order to provide binary operators, you must implement a method on the left object.  From the documentation [0]:&lt;p&gt;&amp;gt; The left operand is the receiver, and the right operand gets passed to it. So a + b is semantically interpreted as “invoke the +(_) method on a, passing it b“.&lt;p&gt;This means that if you want to implement complex numbers, or matrices, or a bunch of other useful stuff, you&amp;#x27;d have to be able to extend the type on the left (which you didn&amp;#x27;t write).  You really want to be able to do things like:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    var z = Complex.new(1.0, 2.0)
    var result = 3.0 - z

    var A = Matrix.ident(3, 3)
    var scaled = 4.0*A
&lt;/code&gt;&lt;/pre&gt;
Python hacks around this by having &amp;quot;right&amp;#x27; versions of these methods too.  It&amp;#x27;s kind of ugly - if the left object fails to support the operator method (__sub__ or __mul__) with the right type, the interpreter looks for a __rsub__ or __rmul__ operator on the right object to try.  Ugly, but it works.&lt;p&gt;C++ works around this a much better way:  You can either have the operator method on the left object, or have an overloaded operator function that isn&amp;#x27;t tied to either object.&lt;p&gt;Rust puts the operators on the left object too, but in some cases you &lt;i&gt;can&lt;/i&gt; add methods&amp;#x2F;trait specializations to left classes.  Unfortunately, Rust doesn&amp;#x27;t let you do this with generics, but that&amp;#x27;s a longer more complicated topic.&lt;p&gt;Maybe there&amp;#x27;s some way Wren lets you tack on additional methods to the builtin Num class (monkey patching), but I couldn&amp;#x27;t find it.  I would love an elegant alternative to Python, but this is enough of an issue that it keeps me from using Wren.&lt;p&gt;[0] - &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;wren.io&amp;#x2F;method-calls.html#operators&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;wren.io&amp;#x2F;method-calls.html#operators&lt;/a&gt;</text></item></parent_chain></comment><story><title>Wren is a small, fast, class-based concurrent scripting language</title><url>https://wren.io/</url></story>