What division operator symbol would you pick?
Posted
by Mackenzie
on Stack Overflow
See other posts from Stack Overflow
or by Mackenzie
Published on 2010-04-29T23:11:15Z
Indexed on
2010/04/29
23:17 UTC
Read the original article
Hit count: 293
I am currently designing and implementing a small programming language as an extra-credit project in a class I'm taking. My problem is that the language has three numeric types: Long, Double, and Fraction. Fractions can be written in the language as proper or improper fractions (e.g. "2 1/3" or "1/2"). This fact leads to problems such as "2/3.5" (Long/Double) and "2/3"(Long/Long) not being handled correctly by the lexer.The best solution that I see is to change the division operator. So far, I think "\" is the best solution since "//" starts comments.
Would you pick "\", if you were designing the language?
Would you pick something else? If so, what?
Note: changing the way fractions are written is not possible.
Thanks in advance for your help,
© Stack Overflow or respective owner