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

Add joyride.core namespace w/ *file* #18

Merged
merged 8 commits into from
May 1, 2022
Merged

Add joyride.core namespace w/ *file* #18

merged 8 commits into from
May 1, 2022

Conversation

PEZ
Copy link
Collaborator

@PEZ PEZ commented Apr 30, 2022

Fixes: #5

It took an embarrassing amount of time for me to figure this out. 😄 But now I think I am starting to get more of it and am glad I didn't give up and tossed it back to you, @borkdude.

These are the minimal changes. I choose to start like this to make the change easier to give and receive feedback on.

I would like to do rename joyride.sci to joyride.core, because it gets a bit of a mind fuck remembering which sci is which.

Also, I updated the example to use this new facility. And then we are now running into the same problem as Calva has with what is on master and what is published. The example won't really work with v0.0.2. In Calva we solve it by having a dev branch where we direct PRs and accumulate changes, We then merge to the default branch when we release. It works, but causes some friction.

@PEZ PEZ requested a review from borkdude April 30, 2022 21:38
@borkdude
Copy link
Collaborator

I'll take a look tomorrow!

@@ -19,7 +19,8 @@
(def !ctx (volatile!
(sci/init {:classes {'js goog/global
:allow :all}
:namespaces (:namespaces pconfig/config)
:namespaces (merge (:namespaces pconfig/config)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing but for performance reasons it's better to just use assoc here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried, but I can't figure out how to do this with assoc while keeping the merge order of joyride.core las...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(assoc (:namespaces ...) 'joyride.core {...})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, of course. 🤦

@@ -21,7 +12,7 @@
(aset editor "selection" original-selection)
(p/do! (eu/insert-text!+ "#_" editor insert-position))))

(when run-main?
(when j/*file*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. It didn't even occur to me that this would maybe already enough for the REPL! Except maybe in the :load-file nREPL operation where this variable would be bound:

https://nrepl.org/nrepl/ops.html#load-file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supplied path and filename info to set source file and line number metadata

So that means this is not the whole solution to #4 then... Since we should actually be doing that, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a part of the solution of #4 so let's continue. The other part is checking of we are currently in the invoked script. E.g. (= *file* (joyride.core/invoked-script)) or so.

@@ -4,6 +4,7 @@
["vscode" :as vscode]
[joyride.nrepl :as nrepl]
[joyride.sci :as sci]
[sci.core]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use:

[joyride.sci :as jsci]
[sci.core as sci]

?

@borkdude
Copy link
Collaborator

borkdude commented May 1, 2022

@PEZ Left a few very minor comments but the overall approach looks good!

@PEZ
Copy link
Collaborator Author

PEZ commented May 1, 2022

@borkdude now it's ready for review again. Thanks in advance! 🙏

@PEZ
Copy link
Collaborator Author

PEZ commented May 1, 2022

Now updated with all implemented promesa.core things.

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.

*file* is not being set
2 participants