pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

Please define `num-pi`, `num-e`

Open shriram opened this issue 6 years ago • 7 comments

These should be pre-defined so people don't need to use atan, etc., to get π.

shriram avatar Dec 18 '18 19:12 shriram

PI is now defined!

jpolitz avatar Dec 15 '20 00:12 jpolitz

Any reason not to close?

schanzer avatar Dec 15 '20 14:12 schanzer

Well, e isn't defined, and we haven't started thinking about how this should interact with the global namespace: e doesn't usually mean the base of natural logarithms, in many portals, so I don't want to co-opt that name by default. But yet we do want PI in the global namespace...

blerner avatar Dec 15 '20 15:12 blerner

What about using some other name like e_log or _e?

(I'd like to work on this if that's OK)

safwansamsudeen avatar Jun 22 '23 23:06 safwansamsudeen

Starting names with an underscore seems like "not good Pyret style", so I don't like that. e_log doesn't look right either; Pyret tends to go for dashes rather than hyphens in its names.

When this issue was filed, Pyret didn't yet have contexts, so it was much bigger of a problem that these numbers weren't defined by default. And in the intervening years... @shriram or @schanzer how often have the lack of these values been a problem for you?

blerner avatar Jun 22 '23 23:06 blerner

Thanks for the suggestion, @safwansamsudeen. But this is not an issue for me, and if it were, I agree with Ben, contexts are the way to go to solve this. It avoids us having to argue about what to call these and just pick the name that works best for our context.

shriram avatar Jun 23 '23 02:06 shriram

@blerner now that contexts are a thing this isn't an issue at all. But it would be nice to get some kind of e constant.....echoes of #486

schanzer avatar Jun 23 '23 13:06 schanzer