Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Sanford Whiteman
While I'm thinking about this (though I should leave it alone): who's to say that PHP won't some day get inner classes? By deciding the default inner member of a class will be a function, you're choosing the one that has a global/procedural equivalent where the short syntax won't work, instead of

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Nikita Nefedov
On 20.02.2013, at 1:42, Sanford Whiteman swhitemanlistens-softw...@cypressintegrated.com wrote: Seems this would complicate the transplanting of (global) functions into (default public) class methods and vice versa. This is a common refactoring task -- at least IME -- and before I adjust

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Nikita Nefedov
On Wed, 20 Feb 2013 08:02:36 -, Sanford Whiteman swhitemanlistens-softw...@cypressintegrated.com wrote: While I'm thinking about this (though I should leave it alone): who's to say that PHP won't some day get inner classes? By deciding the default inner member of a class will be a

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Pierrick Charron
Protip: use an IDE. The IDE that i'm using may search for something like function \w to find all the functions of my code. So I may have to wait for a new update of the IDE to be able to use the index, and I also may have to pay to get the update of my IDE. So why would I want all this if I can

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Sanford Whiteman
Global functions remain its requirement for keyword, just methods lose I understand that. You didn't read my post carefully because I was noting this exact inconsistency. it. And it doesn't mean that you can't write class Foo { function bar() {} } No, it means you _have to_ write it that

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Sanford Whiteman
Classes always should be declared with class keyword, because there could be ambiguity whether it's class, interface or trait. If only inner classes are allowed in a given PHP version, there's no ambiguity about whether something{} just inside a a class is an inner class. That's the

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Nikita Nefedov
On Wed, 20 Feb 2013 09:59:51 -, Sanford Whiteman swhitemanlistens-softw...@cypressintegrated.com wrote: Classes always should be declared with class keyword, because there could be ambiguity whether it's class, interface or trait. If only inner classes are allowed in a given PHP

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Florin Razvan Patan
Sandy, On Wed, Feb 20, 2013 at 11:59 AM, Sanford Whiteman swhitemanlistens-softw...@cypressintegrated.com wrote: Classes always should be declared with class keyword, because there could be ambiguity whether it's class, interface or trait. If only inner classes are allowed in a given PHP

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Sanford Whiteman
So no you are not saying PHP is not Java or C#. I don't want to touch any religious views but it's really funny to read :) Not sure I get your remark... of those languages, I've said, in essence [1] Don't *force* PHP to look less like Java, ECMAScript, C#, or C++ without a good reason and a new

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Sanford Whiteman
As for classes/interfaces/traits and so on, if they are ever added in PHP to be declared inside classes and so on then I see no issues with this. A class/interface or a trait keyword would still be needed to make the difference between a them imho. No, if you *only* allow inner classes at any

RE: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Zeev Suraski
The key question for me is: does removing it hurt PHP in any way? And for me, the answer is a clear and resounding no. This is completely the wrong question to ask (IMHO). I think the answer is wrong too, but that's a different story. The correct question is: Does it bring substantial value

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Ferenc Kovacs
On Wed, Feb 20, 2013 at 12:12 AM, Nikita Nefedov inefe...@gmail.com wrote: On Tue, 19 Feb 2013 19:10:22 -, Rasmus Lerdorf ras...@lerdorf.com wrote: On 02/19/2013 03:07 PM, Nikita Nefedov wrote: Are you grepping for all the functions or you are grepping just for some specific

[PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Nikita Nefedov
Hi! As someone mentioned in the thread about short syntax for closures, we could also drop requirement for `function` keyword when defining/declaring methods in classes, interfaces or traits. I have long noticed how redundant it is. The patch is pretty easy as it was with commas :) It is

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Johannes Schlüter
Hi, On Tue, 2013-02-19 at 21:44 +, Nikita Nefedov wrote: Hi! As someone mentioned in the thread about short syntax for closures, we could also drop requirement for `function` keyword when defining/declaring methods in classes, interfaces or traits. I proposed this in November '10:

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Nikita Nefedov
On Tue, 19 Feb 2013 17:53:40 -, Johannes Schlüter johan...@schlueters.de wrote: I agreed to the conclusion that the function keyword provided a nice way to grep for functions when handling foreign code and leaving it out only provides little improvement in less typing. Please provide new

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Rasmus Lerdorf
On 02/19/2013 02:39 PM, Nikita Nefedov wrote: Hmm, I agree about grepping, but how often do you do it? Actually, last time I grepped php files was half a year ago I think, when I had just ssh connection and didn't want to mount sshfs. But usually there's IDEs that can statically analyze your

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Lester Caine
Rasmus Lerdorf wrote: On 02/19/2013 02:39 PM, Nikita Nefedov wrote: Hmm, I agree about grepping, but how often do you do it? Actually, last time I grepped php files was half a year ago I think, when I had just ssh connection and didn't want to mount sshfs. But usually there's IDEs that can

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Levi Morrison
On Tue, Feb 19, 2013 at 11:53 AM, Lester Caine les...@lsces.co.uk wrote: Rasmus Lerdorf wrote: On 02/19/2013 02:39 PM, Nikita Nefedov wrote: Hmm, I agree about grepping, but how often do you do it? Actually, last time I grepped php files was half a year ago I think, when I had just ssh

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Nikita Nefedov
On Tue, 19 Feb 2013 18:02:57 -, Christopher Jones christopher.jo...@oracle.com wrote: What about including a few basic examples aka test cases in your patch? If the feature is accepted, you'll need to include a LOT of testcases. Chris Hi Chris, this code could be a basic case

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Rasmus Lerdorf
On 02/19/2013 03:07 PM, Nikita Nefedov wrote: Are you grepping for all the functions or you are grepping just for some specific function? If so, you are likely already know what visibility this function has, so couldn't you grep for `public %functionName%` instead of `function

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Nikita Nefedov
On Tue, 19 Feb 2013 19:10:22 -, Rasmus Lerdorf ras...@lerdorf.com wrote: On 02/19/2013 03:07 PM, Nikita Nefedov wrote: Are you grepping for all the functions or you are grepping just for some specific function? If so, you are likely already know what visibility this function has, so

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Johannes Schlüter
On Tue, 2013-02-19 at 23:07 +, Nikita Nefedov wrote: At the end, you can always use `grep '(function|public|private| protected) You've forgotten abstract and static (mind that we don't force the order of those) It saves 9 key strokes (while many IDEs can assist) and helps when looking

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Peter Lind
On 20 February 2013 00:12, Nikita Nefedov inefe...@gmail.com wrote: On Tue, 19 Feb 2013 19:10:22 -, Rasmus Lerdorf ras...@lerdorf.com wrote: On 02/19/2013 03:07 PM, Nikita Nefedov wrote: Are you grepping for all the functions or you are grepping just for some specific function? If so,

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Sanford Whiteman
Seems this would complicate the transplanting of (global) functions into (default public) class methods and vice versa. This is a common refactoring task -- at least IME -- and before I adjust visibility I would expect the function to Just Work. So this works in a class to define the function:

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Zeev Suraski
Are we really trying to look under ground now for ways to change the language syntax? Unless there's a strong case to adding/removing/changing syntax, that goes well beyond 'because we can' or 'it shortens the code' it shouldn't even be brought up for discussion. Zeev On 19 בפבר 2013, at 19:44,

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Patrick ALLAERT
2013/2/19 Nikita Nefedov inefe...@gmail.com: Hmm, I agree about grepping, but how often do you do it? Actually, last time I grepped php files was half a year ago I think, when I had just ssh connection and didn't want to mount sshfs. But usually there's IDEs that can statically analyze your

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Levi Morrison
On Tue, Feb 19, 2013 at 4:01 PM, Zeev Suraski z...@zend.com wrote: Are we really trying to look under ground now for ways to change the language syntax? Unless there's a strong case to adding/removing/changing syntax, that goes well beyond 'because we can' or 'it shortens the code' it

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Rasmus Lerdorf
On 02/19/2013 03:45 PM, Levi Morrison wrote: The key question for me is: does removing it hurt PHP in any way? And for me, the answer is a clear and resounding no. I do not grep code for method definitions: I know exactly where they are and so will my IDE if I happen to not be using vim. And

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Sanford Whiteman
I am something of a language guru and to me syntax is *extremely* important. Am I of the opinion that removing the function keyword from the class definition will help? Yes, I am. I'm missing the help. It saves 9 characters and creates a disjunction between global function syntax and

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Levi Morrison
The key question for me is: does removing it hurt PHP in any way? And for me, the answer is a clear and resounding no. I do not grep code for method definitions: I know exactly where they are and so will my IDE if I happen to not be using vim. And for those who like to grep for method

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Herman Radtke
Protip: use an IDE. Linux is my IDE. -- Herman Radtke @hermanradtke | http://hermanradtke.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Sanford Whiteman
Let's stop pretending that the vast majority of PHP users actually grep source code looking for `function foo`. They don't. *They don't even know how to use grep.* I don't grep as in `grep`, but as in regex search that is part of my IDE but is not also tokenizing/whateverizing/PHP-aware. My

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Johannes Schlüter
On Tue, 2013-02-19 at 17:08 -0700, Levi Morrison wrote: Let's stop pretending that the vast majority of PHP users actually grep source code looking for `function foo`. That was never said, but there's a big number of people who has to deal with code produced by others and doing tasks where it

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Will Fitch
On Feb 19, 2013, at 6:01 PM, Zeev Suraski z...@zend.com wrote: Are we really trying to look under ground now for ways to change the language syntax? Agree 100%. Not to mention, I plan on eventually convincing enough people to replace that keyword with a type hint ;) Unless there's a