Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined keywords #3599

Draft
wants to merge 10 commits into
base: development
Choose a base branch
from
Draft

User-defined keywords #3599

wants to merge 10 commits into from

Conversation

pzinn
Copy link
Contributor

@pzinn pzinn commented Nov 28, 2024

This is very much work in progress, just to demonstrate how to have user-defined keywords: (cf #3593)

i1 : makeKeyword("×")

o1 = ×

o1 : Keyword

i2 : ZZ × ZZ := times

o2 = times

o2 : CompiledFunction

i3 : 1×2

o3 = 2

The most important change is to have a default operation (which applies to 99% of existing keywords, and to the newly created user-defined keywords) which is to look up the corresponding method. so no need to define all these identical functions one-by-one.
Right now only binary operations are properly created, I'm just doing a PR for the tests.

TODO:

  • treat all the different cases (unary, binary, precedence) by adding options to the m2 level makeKeyword
  • simplify drastically actors5.d by removing all unnecessary functions
  • transfer the creation of keywords to m2 level (core)
  • get rid of opsWithBinaryMethod etc
  • get rid of getBinopName etc and rewrite pseudocode accordingly
  • simplify the tex routines
  • possibly remove entirely the fictitious Keyword class, instead providing some information in the Symbol Afterprint
  • fix the other minor issues mentioned in User-created keywords #3593

@pzinn pzinn marked this pull request as draft November 28, 2024 08:12
@pzinn pzinn changed the title 1st attempt: m2 level makeKeyword User-defined keywords Nov 28, 2024
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.

1 participant