Ruby: overriding the constant (volume) resolution operator? (: :)

According to this page, you can override constant-resolution operators in Ruby. (Scroll down to the bottom of the page.) Is that true? If so, how do I do it and why will I ever want to?

+4
source share
1 answer

The Ruby programming language lists only these operators as defined:

! ~ + # Boolean NOT, bitwise complement, unary plus ** # Exponentiation - # Unary minus (define with-@ ) * / % # Multiplication, division, modulo (remainder) + - # Addition (or concatenation), subtraction << >> # Bitwise shift-left (or append), bitwise shift-right & # Bitwise AND | ^ # Bitwise OR, bitwise XOR < <= >= > # Ordering == === != =~ !~ <=> # Equality, pattern matching, comparison 

Source: Yukihiro Matsumoto: β€œRuby Programming Language,” p. 102 (2008, first edition)

So, I think the webpage you provided is simply incorrect.

+2
source

Source: https://habr.com/ru/post/1483816/


All Articles