moonbitlang / core

MoonBit's Core library
https://moonbitlang.com/
Apache License 2.0
615 stars 78 forks source link

Proposal: add func for `float` in `@math` pkg with postfix `f` #1069

Open qazxcdswe123 opened 2 weeks ago

qazxcdswe123 commented 2 weeks ago

Unfortunately unless we bring back Num trait in X and make it generic, it's not possible to overload the function with different argument and same name.

IMO adding f to every Float function looks good enough, like:

Originally posted by @tonyfettes in https://github.com/moonbitlang/core/issues/1050#issuecomment-2398611224

@bobzhang

bobzhang commented 2 weeks ago

we are planning to allow some overriding so that ln ( self : Float | Double) could both work

Lampese commented 4 days ago

we are planning to allow some overriding so that ln ( self : Float | Double) could both work

I have two worries about this solution: