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

Non intrusive support for naming code sites: multi methods #43

Open
kloimhardt opened this issue Feb 4, 2021 · 0 comments
Open

Non intrusive support for naming code sites: multi methods #43

kloimhardt opened this issue Feb 4, 2021 · 0 comments

Comments

@kloimhardt
Copy link

The following 4 code changes have allowed me to do something like (sc.api/defsc :brk-1) in ClojureScript, which pages in the scope prevailing at the last call to (sc.api/spy {:sc/cs-label :brk-1} ...). I argue that the proposed code changes do not alter the behaviour of scope-capture in any way, as they are basically only switching functions to multimethods.

I did three things in sc.impl:

  1. in the map of function make-cs-data I added a key-value pair :sc.cs/label (get opts :sc/cs-label nil)
  2. out of function find-ep I made a (defmulti find-ep #(type %2)) (plus defmethod :default)
  3. out of function resolve-code-site I also made a multimethod (dispatch function type)

In sc.api I
4 . removed the line ep-id (i/resolve-ep-id ep-id) from macro defsc.
This line is rudundant, as the check (validate-ep-identifier ep-id) is triggered by the immediate above call to our (default) resolve-code-site, and the subsequent call to our find-ep does resolve-ep-id ep-id on its own.

With additional definitions of find-ep and resolve-code-site multimethods in my own codebase (here and here), I am able to introduce breakpoints in Clojurescript in the sense described at the beginning.

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

1 participant