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

Feature request: Parse multiple lines between parentheses without commas for macros #39764

Open
jkrumbiegel opened this issue Feb 20, 2021 · 0 comments
Labels
parser Language parsing and surface syntax

Comments

@jkrumbiegel
Copy link
Contributor

jkrumbiegel commented Feb 20, 2021

In Chain.jl I currently offer this syntax:

@chain df begin
	function_1
	function_2(x)
end

Sometimes I think that because the purpose of the package is to reduce complexity / redundancy as much as possible, I'd like this to work:

@chain df (
	function_1
	function_2(x)
)

# or alternative syntax

@chain(
	df
	function_1
	function_2(x)
)

The problem is that multiple lines between parentheses are not allowed, this gives a syntax error due to missing commas. I don't want commas because each line is a separate expression and not an argument to a function. What does work, but what I don't want to use because it looks weird, is this for example:

@chain {
	df
	function_1
	function_2(x)
}

@chain [
	df
	function_1
	function_2(x)
]

I think it would be reasonable to parse the syntax for usage in macros, this wouldn't break existing code. I believe this is a kind of natural extension for macros, because we already break normal syntax rules for macros a little bit by parsing this as one expression:

@somemacro arg1 arg2 begin
	something_long
end even_more trailing_arguments
@JeffBezanson JeffBezanson added the parser Language parsing and surface syntax label Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

2 participants