Skip to content

Conversation

@BKTB888
Copy link

@BKTB888 BKTB888 commented Nov 29, 2025

Hi this is my first contribution to an open-source project so I am not sure I did everything right.

I noticed that there was an inconsistency as the title says with constants, so I fixed it. I hope you agree and like the solution.

@notKamui
Copy link
Owner

notKamui commented Dec 1, 2025

Hello @BKTB888, thanks for your contribution. I'm gonna take a look at it. However, do know that I have been having difficulties with maven for quite a bit and haven't had the time to investigate a lot, so your contribution might not see the light of the publication in a while.

With that being said, the reason e3 was not expanded to e*3 automatically was that e3 has the shape of an identifier. I am not too sure about allowing such behavior. With that fact in mind, what do you think ? Have you tested that it doesn't clash with identifiers (say, you add a new function or constant e3, what should it evaluate to ?). Also, it's arguable that expressions of the form Literal Name (as in 2x) are more conventional than Name Literal (as in x2, which look confusing to me, as does e3)

@BKTB888
Copy link
Author

BKTB888 commented Dec 1, 2025

I have run the basic tests and written some new ones, I haven't tested this particular behaviour, but I think it will work as follows:

If e3 exists as an identifier, it will be interpreted as such.

Else it will be tokenized as e, 3 and that allows the normalizeTokens function to assume multiplication

@notKamui
Copy link
Owner

notKamui commented Dec 1, 2025

This doesn't answer the question and issue conceptually. I am very much not sure considering e3 as anything other that an identifier is a good idea, even if e3 is not defined, also because it's not a conventional way to write 3e

@BKTB888
Copy link
Author

BKTB888 commented Dec 1, 2025

I found it useful while writing a calculator app because, I dont expect an error when i write e3 if I didn’t get an error with 3e. So i think there is a usecase here. And if i write something like elog2(something), the current code would also cause an exception. This would break it down into e*log2, unless there is such an id already, again I would expect this because 3log2 does the same. But I will write more tests to make sure everything works as I think it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants