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

Make parentheses optional for function calls with single parameter string/table #139

Open
Lyrth opened this issue Nov 29, 2023 · 1 comment
Labels
enhancement New feature or request experimental The changes may break something or be a bad idea

Comments

@Lyrth
Copy link

Lyrth commented Nov 29, 2023

Lua supports function calls without parentheses for specific kinds of literals:

-- equivalent to my_func("str")
local a = my_func "str"

-- equivalent to other_func({1, 2})
local b = other_func {1, 2}

Clue could support no-parentheses string calls just fine, and could probably make it work with special strings too (like raw). Although, the table param call will be problematic since code blocks also use { }.

On the other hand, method calls (class::method()) could support single table params as the call can't be confused with a expression + block combination. Slightly useful for class-related structures:

local p = Vec3::new { -4, 2.2, 0 }
@Maiori44
Copy link
Member

calls without () for strings would be fine, but {} could easily get ambiguous so I'm not sure if it's even possible
even if methods wouldn't have this issue, I'd rather not have it work with just methods

@Maiori44 Maiori44 added enhancement New feature or request experimental The changes may break something or be a bad idea labels Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental The changes may break something or be a bad idea
Projects
None yet
Development

No branches or pull requests

2 participants