You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by Stephan Ewen <se...@apache.org> on 2014/10/27 21:04:23 UTC

Code conventions in Scala

Hi!

I have a question about the code conventions in Scala, or more
specifically, about methods without parenthesis.

For example, the ExecutionEnvironment.getExecutionEnvironment takes no
parenthesis, appearing that way like a member of the class, rather than a
method.

Is there some rule when to use methods/functions with parenthesis, and when
without?

Greetings,
Stephan

Re: Code conventions in Scala

Posted by Aljoscha Krettek <al...@apache.org>.
Yes, I'm following that guide for my Scala code.

On Mon, Oct 27, 2014 at 11:04 PM, Henry Saputra <he...@gmail.com> wrote:
> Yes, that is correct.
>
> Scala has code style guide that is used and recommended in Scala based
> application.
> Here is the particular section about 0-arity method calls:
> http://docs.scala-lang.org/style/method-invocation.html
>
> - Henry
>
> On Mon, Oct 27, 2014 at 1:10 PM, Till Rohrmann <ti...@gmail.com> wrote:
>> Hi,
>>
>> as far as I know, it is common to omit the parentheses if the method
>> has no side effects. If it is not pure, then one adds the parentheses.
>>
>> Greets,
>>
>> Till
>>
>> On Mon, Oct 27, 2014 at 9:04 PM, Stephan Ewen <se...@apache.org> wrote:
>>> Hi!
>>>
>>> I have a question about the code conventions in Scala, or more
>>> specifically, about methods without parenthesis.
>>>
>>> For example, the ExecutionEnvironment.getExecutionEnvironment takes no
>>> parenthesis, appearing that way like a member of the class, rather than a
>>> method.
>>>
>>> Is there some rule when to use methods/functions with parenthesis, and when
>>> without?
>>>
>>> Greetings,
>>> Stephan

Re: Code conventions in Scala

Posted by Henry Saputra <he...@gmail.com>.
Yes, that is correct.

Scala has code style guide that is used and recommended in Scala based
application.
Here is the particular section about 0-arity method calls:
http://docs.scala-lang.org/style/method-invocation.html

- Henry

On Mon, Oct 27, 2014 at 1:10 PM, Till Rohrmann <ti...@gmail.com> wrote:
> Hi,
>
> as far as I know, it is common to omit the parentheses if the method
> has no side effects. If it is not pure, then one adds the parentheses.
>
> Greets,
>
> Till
>
> On Mon, Oct 27, 2014 at 9:04 PM, Stephan Ewen <se...@apache.org> wrote:
>> Hi!
>>
>> I have a question about the code conventions in Scala, or more
>> specifically, about methods without parenthesis.
>>
>> For example, the ExecutionEnvironment.getExecutionEnvironment takes no
>> parenthesis, appearing that way like a member of the class, rather than a
>> method.
>>
>> Is there some rule when to use methods/functions with parenthesis, and when
>> without?
>>
>> Greetings,
>> Stephan

Re: Code conventions in Scala

Posted by Till Rohrmann <ti...@gmail.com>.
Hi,

as far as I know, it is common to omit the parentheses if the method
has no side effects. If it is not pure, then one adds the parentheses.

Greets,

Till

On Mon, Oct 27, 2014 at 9:04 PM, Stephan Ewen <se...@apache.org> wrote:
> Hi!
>
> I have a question about the code conventions in Scala, or more
> specifically, about methods without parenthesis.
>
> For example, the ExecutionEnvironment.getExecutionEnvironment takes no
> parenthesis, appearing that way like a member of the class, rather than a
> method.
>
> Is there some rule when to use methods/functions with parenthesis, and when
> without?
>
> Greetings,
> Stephan