swift - odd numbers for operator precedence levels -
just curious..is there particular reason (historical or sort) why swift uses numbers 160 90 express default precedence levels of operators. thanks
according apple's operation declaration documentation
the precedence level can whole number (decimal integer) 0 255
although precedence level specific number, significant relative operator.
the simple answer 90 160 fall near center of 0 255 range.
now if check of apple's binary expressions documentation, see default operators range precedence of 90 precedence of 160, stated in question. range of 70 , because precedence values relative each other, starting/ending point range chosen.
however, if made default values 0 70 or 185 255 when user created custom operator, not give lower precedence 0 or higher precedence 255, causing operator equal precedence of assignment operators or exponentiative operators respectively.
therefore, logical thing start range in middle of 0 255 range , rather set default values of range 93 - 163 (the closest actual center of range possible), chose choose multiples of 10 (90 160) instead because in actuality the values not matter except in relation each other.
Comments
Post a Comment