erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.69k stars 55 forks source link

Implement *-less multiplication #235

Closed mtshiba closed 4 weeks ago

mtshiba commented 1 year ago
x = 1
assert 2x + 1 == 3 # 2*x + 1
assert 2(x+1) == 4 # 2*(x + 1)
assert 2.2x == 2.2

1*m / 1*s # ((1*m)/1)*s
1m / 1s # (1*m)/(1*s)

If Ratio(Float) is made Callable, it is generally possible to multiply variables together like x y. However, this may cause unnecessary confusion, so we do not introduce it. It should be kept within the category of syntax sugar.