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

Dynamic Dot - no closures #215

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

samdphillips
Copy link
Contributor

This is a light modification of the existing dynamic dot lookup protocol. When parens follow a dot expression, it sets a fun? flag and passes the arguments to dot-lookup-by-name. This avoids the closure allocation but may instead cause a list allocation.

Needs to allocate a list though now instead of a closure.
Probably makes a mess of keyword calls.
@mflatt
Copy link
Member

mflatt commented Apr 1, 2022

I'm not sure sure about this one. I see how it lets dotted calls turn into method calls with less in between, but there are some small issues, at least. For one, it looks like there's a kind of mismatch between not handling keywords in dot-lookup-by-name versus the use of make-keyword-procedure in object-dot-lookup. There is also potentially an issue that the function-call form #%call is bound differently than the default.

From the Rhombus meeting yesterday, I was left with the sense that it's better to not build function-call support into dynamic ., and instead rely on some static information to indicate that an expression produces an object (with certain methods?). Only then would . plus () be recognized as a method call (perhaps independent of the #%call binding).

@samdphillips
Copy link
Contributor Author

I'm not sure sure about this one. I see how it lets dotted calls turn into method calls with less in between, but there are some small issues, at least. For one, it looks like there's a kind of mismatch between not handling keywords in dot-lookup-by-name versus the use of make-keyword-procedure in object-dot-lookup. There is also potentially an issue that the function-call form #%call is bound differently than the default.

Yes, this is more of an experiment to see how hard it would be to get something to play around with. Using dynamic dot to access a function or closure (instead of a more complicated protocol) is probably better than trying to be clever.

From the Rhombus meeting yesterday, I was left with the sense that it's better to not build function-call support into dynamic ., and instead rely on some static information to indicate that an expression produces an object (with certain methods?). Only then would . plus () be recognized as a method call (perhaps independent of the #%call binding).

I still think dynamic . could be useful but after more design of the object/class/method/whatever system is worked out.

@mflatt
Copy link
Member

mflatt commented Apr 2, 2022

Ok if we keep this open, though? That will make the experiment easier to find until we sort out everything.

@samdphillips samdphillips reopened this Apr 2, 2022
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.

None yet

2 participants