wordplaydev / wordplay

An accessible, language-inclusive programming language and IDE for creating interactive typography on the web.
Other
63 stars 44 forks source link

Numerals vs Numbers #244

Closed orcmid closed 1 year ago

orcmid commented 1 year ago

Expected behavior

The distinction between numerals and numbers is nicely made at LANGUAGE.md line 73.

Actual behavior

The use of number in the production at LANGUAGE.md line 71 seems unfortunate.

I am also a bit uncomfortable with the inclusion of pi and infinity. They are very different in kind from the numerals and I think this is going to be troublesome for the departure from mathematics this requires, no matter how much CS tolerates them.

amyjko commented 1 year ago

Can you elaborate on what you see as the defect here? Are you reporting a language design defect, a language design opinion, or a defect in the language specification?

orcmid commented 1 year ago

@amyjko

Can you elaborate on what you see as the defect here? Are you reporting a language design defect, a language design opinion, or a defect in the language specification?

Sorry for being obtuse about it. I think "numeral" is a better name than "number" for the lexical production. You use numeral in the comment after that production and I applaud that.

I am separately grumpy about using the pi and infinity symbols as numerals, since they are not numerals of the kind the production elaborates otherwise. They are not (computationally) definite for one thing. Or at least they won't be in Wordplay programs. (I also think that the ALGOL 60 and other languages using real as a type was a disservice. That may all be FORTRAN's fault. The C/C++ use of float (and also int) and others was a serious improvement.)

I know not to fight the last to the death, but I would rather not have a language be casual about pi and especially infinity.

amyjko commented 1 year ago

π refers to JavaScript's Math.PI approximation, which is definite. Being pedantic about that is fine; this isn't a programming language that intends to be mathematical in the way you want to it to be, since that's not it's goal.

explicitly refers to Decimal.js Infinity semantics, which you can read up on here:

https://mikemcl.github.io/decimal.js/#zero-nan-infinity

Again, the goal isn't to faithfully represent mathematics.