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

Omitting parentheses #4

Open
ghost opened this issue Jul 12, 2015 · 5 comments
Open

Omitting parentheses #4

ghost opened this issue Jul 12, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Jul 12, 2015

It would be nice you could omit parentheses at function call (just like CoffeScript or Ruby).
CokeScript compiler code is so easy to read! Thank you for your project.

@batiste
Copy link
Owner

batiste commented Jul 13, 2015

Thanks for your kind words. I am not sure what you mean by omitting parenthesis. You can definitely omit then on the declaration:

def test
    1 + 1

Maybe you mean omitting at call time? It is not impossible to do but it is definitely a more complex process.

@batiste
Copy link
Owner

batiste commented Jul 13, 2015

Sorry I read again and I have seen you said at call time. This definitely possible to implement but I have personally a strong distaste for omitting then at call time. This is against the explicitness of Python and I find it makes the source code more difficult to read.

I am discovering how CoffeScript works, e.g.

 a = -> 1 + 1
 a # not called here
 a 1 # called: a(1)
 a 1, 2 # called: a(1, 2) 
 a 1 2 # error

It kinda make sense and should be rather easy to implement as the syntax seems to be non contextual to previous function declaration.

@vlad0337187
Copy link

@batiste , I think that this is only because you didn't used to it.
I like way it was implemented in CaffeineScript:
https://github.com/caffeine-suite/caffeine-script/wiki/Function-Invocation

Also I'd like to sugges block comment / array / object / string literals from that project.
It's really clean-looking.

@batiste
Copy link
Owner

batiste commented May 4, 2018

@vlad1777d I have used them in Ruby and I have found it makes some piece of code extremely difficult to read.

Explain to me what that does:

a b c

Is it a(b, c) or is it a(b(c)) ? It terribly ambiguous to me and to many people that are used to c-like language a clear loss in readability.

@vlad0337187
Copy link

@batiste, in CaffeineScript it's passing arguments to some function:
a(b, c).

If such happens, explicit specifying of parenthesis could help.
Btw, in CaffeineScript there is also block function invocation, like:

a
    b
    c

Looks enough clean:
screenshot from 2018-05-04 21-19-00
Line 129, for example.
=)

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

2 participants