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

replace py_str with py_cmd literal? #793

Open
simeonschaub opened this issue Jul 13, 2020 · 3 comments · May be fixed by #794
Open

replace py_str with py_cmd literal? #793

simeonschaub opened this issue Jul 13, 2020 · 3 comments · May be fixed by #794

Comments

@simeonschaub
Copy link
Contributor

I think, semantically it makes more sense to use custom command literals instead of string literals for code in other languages, since I think it is important to distinguish code from plain strings. The default shell is already a different language within Julia, so I think it is reasonable to extend this concept to interop with other languages. This could also then be used by editors to customize syntax highlighting for Python code inside Julia, as already proposed in JuliaEditorSupport/julia-emacs#132. The current string syntax could still be kept around, of course, and perhaps deprecated eventually. I would be curious to hear others' opinions on this.

@stevengj
Copy link
Member

Seems reasonable to me.

(cmd macros didn’t exist when py_str was introduced, IIRC)

@simeonschaub simeonschaub linked a pull request Jul 14, 2020 that will close this issue
@tkf
Copy link
Member

tkf commented Jul 15, 2020

r"regex" is used for wrapping "another language". So, it's not clear to me if @*_cmd should always be used for using other languages. I agree that it could be a reasonable convention to have. But it doesn't seem like we have a consistent convention yet. Unless there is a strong convention, I'm not sure if introducing (future) breaking change is a good idea.

Also, @py_cmd could be used for constructing a lazy object that holds a piece of Python code and Julia objects to be injected. This way, run(py`...`) and py"..." would be equivalent. It might be handy for tweaking evaluation contexts (e.g., namespace dict, top-level vs function vs async function).

@simeonschaub
Copy link
Contributor Author

simeonschaub commented Jul 18, 2020

Thanks for chiming in! I understand your concerns, that it is probably best to establish a standard first, before we make breaking changes. What would you suggest as a path forward for establishing a standard for nested highlighting like this? Is this something that should maybe be a Julep? I do think the ``` for command literals would be a pretty nice convention for this, since it's very reminiscent of how syntax highlighting works in Markdown. I do understand that having ``` be lazy might be useful as well, I don't really have a strong opinion on this.

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 a pull request may close this issue.

3 participants