Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Handling braces with methods without arguments

by Jenda (Abbot)
on Sep 17, 2012 at 12:18 UTC ( [id://994027]=note: print w/replies, xml ) Need Help??


in reply to Handling braces with methods without arguments

Perl doesn't care, but in some well known languages the form without the braces would not call the method, but rather return a reference to the method (JavaScript and C# come to mind, not sure about Java ... though in C# it's a bit more complicated than that ...). Mainly to prevent confusion for people using those languages, I'd recommend using the second syntax. I don't see any reason to include the space within the braces.

Jenda
Enoch was right!
Enjoy the last years of Rome.

  • Comment on Re: Handling braces with methods without arguments

Replies are listed 'Best First'.
Re^2: Handling braces with methods without arguments
by McA (Priest) on Sep 17, 2012 at 12:54 UTC

    This is a nice argument which didn't come to my mind. Thank you. You forget python in the list.

    Best regards
    McA

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://994027]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found