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

Generic function support? #25

Open
kchanqvq opened this issue Oct 3, 2021 · 1 comment
Open

Generic function support? #25

kchanqvq opened this issue Oct 3, 2021 · 1 comment

Comments

@kchanqvq
Copy link

kchanqvq commented Oct 3, 2021

Does this work with generic functions? I was always assuming "no" and that's a major pain point when using it.

I've had enough and would probably look into implementing support for it. Do you think it's doable?

@nikodemus
Copy link
Owner

Sorry about the long response time!

If you mean, "can I call generic functions from screamer/non-deterministic functions", the answer is yes. (At least I don't immediately see any reason why it would not work, but it's been a good while since I've last actively used or worked on Screamer, so maybe I forget?)

If you mean, "can I define a generic screamer/non-deterministic function", the answer is no. I was going to say that excluding CALL-NEXT-METHOD support it would probably be relatively speaking simple, but trying to outline how it would work I started thinking it's not as simple. The problem is that I don't remember exactly how the Screamer code walking transformation works. I still think it's doable, but not sure how tricky.

I would start with something like:

(define-screamer-method foo ((x some-class))
   ...body...)

=>

(define-screamer-function #:foo-method-gensym (x)
    ...body...)
    
 (defmethod foo ((x some-class))
    (#:foo-method-gensym x))

generating a separate ND function for each ND method. CALL-NEXT-METHOD won't work, and I don't frankly remember what you need to do to enter ND context from non-ND context - frank I think what I've outline above doesn't work quite like that... but it's what I would start with, then figuring out why it doesn't work.

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

No branches or pull requests

2 participants