Issue #7322 has been reported by alexeymuranov (Alexey Muranov). ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322 Author: alexeymuranov (Alexey Muranov) Status: Open Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-10 12:26
on 2012-11-10 20:51
> "a^n" usually means "the n-th power of a"
I agree, I think using "^" for exponents would be more consistent with
other languages. I don't have a strong opinion on a replacement for
'exclusive or', but some other approximations of "⊻" could be: "|<" or
"/<".
on 2012-11-12 16:20
Issue #7322 has been updated by alexeymuranov (Alexey Muranov). Related: #6678. ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32817 Author: alexeymuranov (Alexey Muranov) Status: Open Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-15 18:56
Issue #7322 has been updated by trans (Thomas Sawyer). Given the rejection of #7336, I would ask this this issue be more seriously considered. Personally, I don't really care if #^ continues to mean bitwise xor for numerics, but at least raise its precedence to be the same as #**, and provide an alternative xor operator with the present precedence. Whether `#><` is a good choice or not, I am mostly indifferent. (I suppose alternatives might be `#~` or `#!` which are unary operators, but have no binary definition.) ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32936 Author: alexeymuranov (Alexey Muranov) Status: Open Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 00:29
Issue #7322 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected So what's your intention? To make '^' a power operator, and ruin innocent programs? Because you feel "natural"? If Ruby were young and there were no (or few) Ruby programs out there, your proposal might be useful. But I don't want to break compatibility for fashion. "When in Rome, do as the Romans do". Matz. ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32945 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 00:43
Issue #7322 has been updated by david_macmahon (David MacMahon). I fully agree that repurposing '^' to be a power operator is not a good idea. One alternative idea that might not make anyone happy would be to create a new power operator "^^" that is the same as "**", but seems more like exponentiation to those too young to know (or too old to remember :-)) Fortran. Please feel free to ignore this suggestion, Dave ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32946 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 01:38
Issue #7322 has been updated by trans (Thomas Sawyer). @matz Have you ever read about issue I have with implementing Stick b/c of this? I have no Rome to be in. I am in Carthage! @dvaid_macmahon Well, #^^ would be better than nothing. ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32948 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 02:03
Issue #7322 has been updated by matz (Yukihiro Matsumoto). No. There are so many "issues" out there. I don't have time to check them all. Reference please. Matz. ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32949 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 16:00
Issue #7322 has been updated by alexeymuranov (Alexey Muranov). Speaking of Fortran, there the binary `*` has higher precedence than the unary `-`, which has approximately the same as the binary one. (This is not about this issue, but about #7328 and #7331.) I would way it is unfortunate that the main reason to reject it that Ruby is too old to change. (The changes would not need to be immediate, i think that aliases can be introduced or deprecated between major versions.) But i am not a heavy Ruby user, i was only proposing my ideas hoping that they could be useful for others too. ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32963 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 17:29
Issue #7322 has been updated by trans (Thomas Sawyer).
=begin
@matz
Reference given below[1], but I can give very brief summary to save you
time...
Stick is an SI units system for Ruby. While in pure math there is just
one type of "power" (in Ruby provided by (({#**}))), in physical systems
there is also units and units themselves can have "power", e.g. cubic
meters. So any good units system therefore ((*needs two power
operators*)), one for the value and one for the unit. The natural
notation for these are, e.g.
10.m**3 (10 meters * 10 meters * 10 meters)
10.m^3 (10 cubic meters)
But precedence of (({#^})) is too low in Ruby to do this well, e.g.
10.m^2/2 => 10 meters, instead of 5.m^2
Nor is there some alternative operator to utilize.
Unit powers is a common real word application, so I think it is not
unreasonable to seek that Ruby be able to accommodate such a use case.
In short, for me to create the best SI units system I can for Ruby, I
need another power operator.
[1]
https://github.com/trans/trans.github.com/wiki/200...
=end
----------------------------------------
Feature #7322: Add a new operator name #>< for bit-wise "exclusive or"
https://bugs.ruby-lang.org/issues/7322#change-32975
Author: alexeymuranov (Alexey Muranov)
Status: Rejected
Priority: Low
Assignee:
Category:
Target version:
=begin
I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for
bit-wise "exclusive or", with a new operator name (({#><})).
Is it necessary to go along with C, Python, and Mathematica?
According to Wikipedia (
http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^"
symbol is not used for XOR outside of programming context.
Here are some examples of mathematical notation:
http://mathworld.wolfram.com/XOR.html (there are also examples in the
Wikipedia article).
The Unicode symbol is "⊻".
If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate
this symbol for other uses, for example for all kinds of exponential
notations (for me, "a^n" usually means "the n-th power of a").
=end
on 2012-11-16 18:30
Issue #7322 has been updated by stomar (Marcus Stollsteimer). @trans There is only one type of power operator in physics. You would have to use parentheses: (10 m)^3 (10 meters * 10 meters * 10 meters) 10 m^3 (10 cubic meters) And I think you should also have to use them in the code. From a physicist's point of view, I find the idea of distinguishing between different kinds of power operators strange at best, probably confusing to the user and maybe even dangerous. ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32983 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 18:57
Issue #7322 has been updated by alexeymuranov (Alexey Muranov). Thomas, i agree with @stomar. ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32986 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 19:13
Issue #7322 has been updated by trans (Thomas Sawyer). =begin @stomer Yes and no. The problem is in the Ruby notation. In physics, you can use parenthesis to make the distinction, but you can't in Ruby. e.g. Your example doesn't work in Ruby: 10.m**3 and (10.m)**3 Can only produce the same result. =end ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32987 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-16 19:34
Sorry, I didn't read the whole thread, but why not use the right
operators?
g = 9.81 * m / s ** 2
on 2012-11-16 19:42
Issue #7322 has been updated by stomar (Marcus Stollsteimer). =begin @trans Imo the point is that using a method for the unit does not correctly model the mathematical relation (and hence the precedence) between the numerical value of the physical quantity and its unit, which simply is a multiplication. Just a thought: how about using an argument for the power of the unit, like in 10.m**3 # (10 m)^3 10.m(3) # 10 m^3 But this is taking a very off-topic direction... =end ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-32989 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-17 10:55
Issue #7322 has been updated by trans (Thomas Sawyer).
=begin
It might seem like it, but designating a unit is not multiplication.
(({9.81 * m})) actually means (({9.81 * 1 m}))
Implementation wise this approach is a bit messier too. It requires
overriding the built-in #* method and adding a slew of type methods to
Object (e.g. Object#m).
@stomer Using an argument for the unit power isn't a skeuomorphic ideal.
But it might suffice. I need to give it some thought and take a look at
the Stick code to make sure. I'll try to do that today and report back.
Thanks.
Speaking of a skeuomorphic ideal, do you notice that in general contexts
when people give ascii examples of "power" they always use (({^}))? I
don't really understand why language designers are so bent on bucking
the overwhelming commonality of this choice --all solely to cling to C's
tradition of using (({^})) as XOR? How unfortunate. But anyway, I
digress.
=end
----------------------------------------
Feature #7322: Add a new operator name #>< for bit-wise "exclusive or"
https://bugs.ruby-lang.org/issues/7322#change-33012
Author: alexeymuranov (Alexey Muranov)
Status: Rejected
Priority: Low
Assignee:
Category:
Target version:
=begin
I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for
bit-wise "exclusive or", with a new operator name (({#><})).
Is it necessary to go along with C, Python, and Mathematica?
According to Wikipedia (
http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^"
symbol is not used for XOR outside of programming context.
Here are some examples of mathematical notation:
http://mathworld.wolfram.com/XOR.html (there are also examples in the
Wikipedia article).
The Unicode symbol is "⊻".
If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate
this symbol for other uses, for example for all kinds of exponential
notations (for me, "a^n" usually means "the n-th power of a").
=end
on 2012-11-17 11:01
Issue #7322 has been updated by trans (Thomas Sawyer). Hmm... "skeuomorphic" probably isn't really the right word actually. I really meant something more like "reflecting reality". In this case, specifically, "best reflecting common mathematical notation". ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-33013 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
on 2012-11-17 11:24
Issue #7322 has been updated by alexeymuranov (Alexey Muranov). Thomas, let some physicist correct me, but i thought that designating units was multiplication: 9.81 m/s^2 = (9.81 * m)/(s^2). This should however be discussed in a different thread. :) ---------------------------------------- Feature #7322: Add a new operator name #>< for bit-wise "exclusive or" https://bugs.ruby-lang.org/issues/7322#change-33017 Author: alexeymuranov (Alexey Muranov) Status: Rejected Priority: Low Assignee: Category: Target version: =begin I propose to alias (({Fixnum#^})) and (({Bignum#^})), which stand for bit-wise "exclusive or", with a new operator name (({#><})). Is it necessary to go along with C, Python, and Mathematica? According to Wikipedia ( http://en.wikipedia.org/wiki/Exclusive_or#Alternat... ), the "^" symbol is not used for XOR outside of programming context. Here are some examples of mathematical notation: http://mathworld.wolfram.com/XOR.html (there are also examples in the Wikipedia article). The Unicode symbol is "⊻". If eventually (({Fixnum#^})) as XOR is deprecated, this will liberate this symbol for other uses, for example for all kinds of exponential notations (for me, "a^n" usually means "the n-th power of a"). =end
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.