Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-04 Thread Pierre Joye
On Oct 4, 2014 4:01 AM, Andrea Faulds a...@ajf.me wrote:


 On 3 Oct 2014, at 17:21, Thomas Gossmann m...@gossimaniac.net wrote:

  I was wondering if it is possible to deprecate/remove the function
keyword from class methods in php7 or at least make it optional when one of
the visibility keywords is present?
 
  I feel like writing a completely unnecessary keyword each time I write
a new method for a class.
 
  I guess this was a discussion earlier, though I wasn't able to find
anything about it. Would love to hear, what pdt-internals (re-)think about
that topic.

 Me and Pierre have discussed this before, Pierre was in favour of it last
time we talked about it. I’d certainly be in favour of allowing `function`
to be omitted when there’s a visibility specifier, like so:

  public foo() {}
  public static foo() {}

 Easy to implement, too. What are the list’s thoughts? I don’t think it
really hampers readability much.

Same here. Also while not being against that, I am not a fan or removing
things that make hard to have code for 5.x and 7.x. That will make
migrations harder for little to no gain.

Did we not have a rfc about that already?


Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-04 Thread Thomas Gossmann
Thank you for your input and comments, which let me think through some 
of them and my initial thoughts. Here is what I come up with.


Perfection is reached when there is nothing left to remove. So in a 
perfect world, a class could look like this:


class Foo {
bar() {}
baz() {}
}

When the visibility specifier is omitted, it defaults back to public 
(However, personally I don't think this is good practice). Semantically 
it is not even a function, it is a method. Literally the function 
keyword is a tautology, because actually the parens signal what that 
property is, which raises redundancy in writing the function keyword.


The converse argument basically marks its gain, writing redundant 
syntactical parts is removed. Yes, IDEs can help with that (though I'm 
faster typing function instead of triggering auto-complete, because it 
shifts my hand off writing) but given the fact that I must do it, 
although unnecessary, questions its existence - instead of let the dev 
continue typing.


My simple example from above is a result which also happened in the 
javascript world, where they also abandoned the function keyword for 
classes, because parens offer the semantics. To me it is more readable 
and as a person who cares for esthetics I think this is also more 
beautiful. Hence, for php-beginners, this example of a simple class is a 
good start, which can also be used educating them in OOP by adding the 
more advanced parts - instead of letting them write function when this 
actually is a method (In my eyes, education failed here).



I really see a point in support tooling, which is fundamental to support 
programming languages. What wonders me, is that arguments targeting 
tooling (secondary consumers) have more value than those arguments 
targetting php developers (primary consumers) (or at least this is how I 
recognize them - please hint me if I'm wrong). As long as it wouldn't 
make detecting methods impossible, it just raises the challenge for 
tooling authors, but that's it. Basically, you write your detection 
algorithm for methods once and then reuse it vs. php developers writing 
methods over and over again. I think in a statistical investigation, the 
latter outnumber the first.
For those, that want to grep their code for a function keyword, still 
can continue to write it (only for sake of beeing able to grep it).


To summarize and conclude the gains of making the function keyword for 
methods optional, which keeps BC intact:

- Remove writing a redundant unnecessity (faster writing)
- Remove the failure of educating beginners wrong
- Easier classes for beginners

At the cost of a slight improved challenge for tooling authors and their 
detecting algorithms for methods, which they probably write once - I 
think this is a fair trade.


Thomas Gossmann

Am 03.10.14 um 22:57 schrieb Andrea Faulds:


On 3 Oct 2014, at 17:21, Thomas Gossmann m...@gossimaniac.net wrote:


I was wondering if it is possible to deprecate/remove the function keyword from 
class methods in php7 or at least make it optional when one of the visibility 
keywords is present?

I feel like writing a completely unnecessary keyword each time I write a new 
method for a class.

I guess this was a discussion earlier, though I wasn't able to find anything 
about it. Would love to hear, what pdt-internals (re-)think about that topic.


Me and Pierre have discussed this before, Pierre was in favour of it last time 
we talked about it. I’d certainly be in favour of allowing `function` to be 
omitted when there’s a visibility specifier, like so:

  public foo() {}
  public static foo() {}

Easy to implement, too. What are the list’s thoughts? I don’t think it really 
hampers readability much.
--
Andrea Faulds
http://ajf.me/






--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-04 Thread Johannes Schlüter
On Fri, 2014-10-03 at 18:21 +0200, Thomas Gossmann wrote:
 I guess this was a discussion earlier, though I wasn't able to find 
 anything about it. Would love to hear, what pdt-internals (re-)think 
 about that topic.

Go to wiki.php.net/rfc look at the titles containing function and you
will see Make T_FUNCTION in method declarations optional which was
added by me. https://wiki.php.net/rfc/optional-t-function

Since proposing I was convinced this wasn't good. Please bring new
arguments. Discussion was in this thread
http://news.php.net/php.internals/50628 (another viewer might be better
to find the ~64 followups)

johannes



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-04 Thread Thomas Gossmann
Thanks Johannes, I slipped over it but would have never found the 
discussion to it.


I run over it and the summary is: Many people like it and those that 
don't have brought arguments, that are present here again. The 
discussion is almost 4 years old by now, and people are complaining over 
things getting implemented in php back in time, which are now 
implemented and turned out to be ok - I expect the same to happen with 
this idea.
Main contra argument is, people are not able to grep for 'function *' 
anymore, which I guess is a minority of people and they can write 
themselves a shell-script which makes it possible to search for 
functions again, so not a big deal. However, the more important 
statement behind this is, who is the more important crowd of people that 
are targeted with changes like these? Primary or secondary consumers?

... but see my other mail, which conatains answers.

Though, I have one question left regarding the old rfc? Why it has been 
gone inactive and basically slept since then?


Thanks
Thomas Gossmann

Am 04.10.14 um 19:44 schrieb Johannes Schlüter:

On Fri, 2014-10-03 at 18:21 +0200, Thomas Gossmann wrote:

I guess this was a discussion earlier, though I wasn't able to find
anything about it. Would love to hear, what pdt-internals (re-)think
about that topic.


Go to wiki.php.net/rfc look at the titles containing function and you
will see Make T_FUNCTION in method declarations optional which was
added by me. https://wiki.php.net/rfc/optional-t-function

Since proposing I was convinced this wasn't good. Please bring new
arguments. Discussion was in this thread
http://news.php.net/php.internals/50628 (another viewer might be better
to find the ~64 followups)

johannes




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-04 Thread Rowan Collins

On 04/10/2014 17:10, Thomas Gossmann wrote:
Hence, for php-beginners, this example of a simple class is a good 
start, which can also be used educating them in OOP by adding the more 
advanced parts - instead of letting them write function when this 
actually is a method (In my eyes, education failed here). 


I'm not sure there is really as clear-cut a distinction as you imply 
here, such that the word function is wrong when used for a method.


PHP has 4 different types of sub-routines (unless I've forgotten one):
- global functions, which needn't return anything, so encompass what 
some languages call procedures
- object/instance methods, which are virtual (polymorphic), 
inheritable and overridable subroutines called on an instance, with the 
magic variable $this defined
- static methods, which have the same inheritance and overriding 
semantics as methods, and have access to private and protected members 
of the class, but do not require an instance, and do not define $this
- anonymous functions, or closures, which are actually a complete 
object encapsulating both code and state


Different languages call these concepts, and other variations on the 
same themes, by various names. In PHP, they are all introduced by the 
keyword function, which indicates here begins a sub-routine declaration.


--
Rowan Collins
[IMSoP]


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-04 Thread Rowan Collins

On 03/10/2014 18:57, Ingwie Phoenix wrote:

C++ does not use a function keyword by itself, and even lesser visibility 
keywords as PHP does.


There have been a couple of comparisons to other languages brought up, 
but I find them unconvincing.


Most languages have some keyword for introducing methods: def in Ruby; 
sub in Perl (or method when using some of the OO helper extensions 
such as MooseX::Declare); defun in Common Lisp; procedure (or 
function) in Pascal; etc


In C-based languages including C++ and Java, the return type of a 
function is a compulsory part of the function definition, so a 
definition never begins simply foo() { ... }. This gives the code 
structure a very different feel to loosely typed languages.


ECMAScript 6 is an interesting exception which someone mentioned. But 
then, ECMAScript 6 is quite a strange language, really - it grafts a 
class concept onto a prototype-based type system, and includes a whole 
set of different sub-routine declarations to overcome limitations in 
earlier versions of the language, as summarised here: 
http://www.2ality.com/2013/08/es6-callables.html


Now, obviously, PHP doesn't have to follow like a sheep wherever other 
languages go, but if I read a line in the change log for PHP 7 of 
function keyword is now optional for methods, my reaction would be a 
bemused why?, followed by a mental note to require it in any coding 
standards I have influence over.


--
Rowan Collins
[IMSoP]


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-04 Thread Kris Craig
On Oct 4, 2014 11:24 AM, Thomas Gossmann m...@gossimaniac.net wrote:

 Thanks Johannes, I slipped over it but would have never found the
discussion to it.

 I run over it and the summary is: Many people like it and those that
don't have brought arguments, that are present here again. The discussion
is almost 4 years old by now, and people are complaining over things
getting implemented in php back in time, which are now implemented and
turned out to be ok - I expect the same to happen with this idea.
 Main contra argument is, people are not able to grep for 'function *'
anymore, which I guess is a minority of people and they can write
themselves a shell-script which makes it possible to search for functions
again, so not a big deal. However, the more important statement behind this
is, who is the more important crowd of people that are targeted with
changes like these? Primary or secondary consumers?
 ... but see my other mail, which conatains answers.

 Though, I have one question left regarding the old rfc? Why it has been
gone inactive and basically slept since then?

 Thanks
 Thomas Gossmann

 Am 04.10.14 um 19:44 schrieb Johannes Schlüter:

 On Fri, 2014-10-03 at 18:21 +0200, Thomas Gossmann wrote:

 I guess this was a discussion earlier, though I wasn't able to find
 anything about it. Would love to hear, what pdt-internals (re-)think
 about that topic.


 Go to wiki.php.net/rfc look at the titles containing function and you
 will see Make T_FUNCTION in method declarations optional which was
 added by me. https://wiki.php.net/rfc/optional-t-function

 Since proposing I was convinced this wasn't good. Please bring new
 arguments. Discussion was in this thread
 http://news.php.net/php.internals/50628 (another viewer might be better
 to find the ~64 followups)

 johannes



 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php


Summary thus far:

Pro:  Eliminating the function keyword is good because coding ===
sculpting; perfection occurs when there's nothing left to remove.

Con:  It's completely unnecessary and would make it prohibitively difficult
to consistently locate subroutine declarations in a codebase.

I believe the cons vastly outweigh the pros in this case.  The function
keyword is a very good example of PHP's KISS (Keep It Simple, Stupid)
philosophy.

But if you're serious about this, draft an RFC and we'll vote on it.  If
2/3 support your idea, it'll pass.

--Kris


Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-04 Thread Ingwie Phoenix

Am 05.10.2014 um 00:10 schrieb Kris Craig kris.cr...@gmail.com:

 On Oct 4, 2014 11:24 AM, Thomas Gossmann m...@gossimaniac.net wrote:
 
 Thanks Johannes, I slipped over it but would have never found the
 discussion to it.
 
 I run over it and the summary is: Many people like it and those that
 don't have brought arguments, that are present here again. The discussion
 is almost 4 years old by now, and people are complaining over things
 getting implemented in php back in time, which are now implemented and
 turned out to be ok - I expect the same to happen with this idea.
 Main contra argument is, people are not able to grep for 'function *'
 anymore, which I guess is a minority of people and they can write
 themselves a shell-script which makes it possible to search for functions
 again, so not a big deal. However, the more important statement behind this
 is, who is the more important crowd of people that are targeted with
 changes like these? Primary or secondary consumers?
 ... but see my other mail, which conatains answers.
 
 Though, I have one question left regarding the old rfc? Why it has been
 gone inactive and basically slept since then?
 
 Thanks
 Thomas Gossmann
 
 Am 04.10.14 um 19:44 schrieb Johannes Schlüter:
 
 On Fri, 2014-10-03 at 18:21 +0200, Thomas Gossmann wrote:
 
 I guess this was a discussion earlier, though I wasn't able to find
 anything about it. Would love to hear, what pdt-internals (re-)think
 about that topic.
 
 
 Go to wiki.php.net/rfc look at the titles containing function and you
 will see Make T_FUNCTION in method declarations optional which was
 added by me. https://wiki.php.net/rfc/optional-t-function
 
 Since proposing I was convinced this wasn't good. Please bring new
 arguments. Discussion was in this thread
 http://news.php.net/php.internals/50628 (another viewer might be better
 to find the ~64 followups)
 
 johannes
 
 
 
 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 Summary thus far:
 
 Pro:  Eliminating the function keyword is good because coding ===
 sculpting; perfection occurs when there's nothing left to remove.
- The function keyword does not comply to the fact that its used on class 
methods.
- It’s a duplicate, when the parantheses already indicate a „function“.

 
 Con:  It's completely unnecessary and would make it prohibitively difficult
 to consistently locate subroutine declarations in a codebase.
- People can no longer use a simple grep command to pick up functions.
- IDE’s will have to adapt to a longer search pattern.

 
 I believe the cons vastly outweigh the pros in this case.  The function
 keyword is a very good example of PHP's KISS (Keep It Simple, Stupid)
 philosophy.
 
 But if you're serious about this, draft an RFC and we'll vote on it.  If
 2/3 support your idea, it'll pass.
 
 --Kris

Sorry, but if you summarize arguments, it’d be only fair to read back and 
actually name as many as possible.

Not everybody can vote though, sadly. I still wish there was a way for non-devs 
to have a voice on feature votes.

Kind regards, Ingwie.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Levi Morrison
On Fri, Oct 3, 2014 at 10:21 AM, Thomas Gossmann m...@gossimaniac.net
wrote:

 Hey there,

 I'm just a php developer, thus not even having a php.net account.

 I was wondering if it is possible to deprecate/remove the function keyword
 from class methods in php7 or at least make it optional when one of the
 visibility keywords is present?

 I feel like writing a completely unnecessary keyword each time I write a
 new method for a class.

 I guess this was a discussion earlier, though I wasn't able to find
 anything about it. Would love to hear, what pdt-internals (re-)think about
 that topic.

 Thanks,
 gossi


Removing the function keyword makes it more difficult for people to find
method definitions. This has historically been a significant factor in why
this hasn't been done.

Also, what does this change actually bring to the table? There is no actual
benefit to the language or tooling; in fact it probably makes the tooling
more difficult. All this means is that the user types the function keyword
less and saves a very, very small amount of time.

In summary, historically we have felt that the benefits do not outweigh the
drawbacks.


Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Ingwie Phoenix

Am 03.10.2014 um 19:38 schrieb Levi Morrison le...@php.net:

 On Fri, Oct 3, 2014 at 10:21 AM, Thomas Gossmann m...@gossimaniac.net
 wrote:
 
 Hey there,
 
 I'm just a php developer, thus not even having a php.net account.
 
 I was wondering if it is possible to deprecate/remove the function keyword
 from class methods in php7 or at least make it optional when one of the
 visibility keywords is present?
 
 I feel like writing a completely unnecessary keyword each time I write a
 new method for a class.
 
 I guess this was a discussion earlier, though I wasn't able to find
 anything about it. Would love to hear, what pdt-internals (re-)think about
 that topic.
 
 Thanks,
 gossi
 
 
 Removing the function keyword makes it more difficult for people to find
 method definitions. This has historically been a significant factor in why
 this hasn't been done.
 
 Also, what does this change actually bring to the table? There is no actual
 benefit to the language or tooling; in fact it probably makes the tooling
 more difficult. All this means is that the user types the function keyword
 less and saves a very, very small amount of time.
 
 In summary, historically we have felt that the benefits do not outweigh the
 drawbacks.


I usually just observe on this list, but this is a topic I have come across 
myself.

PHP has followed the C++ syntax, and logical scoping like namespace,s since a 
long time - if not, eversince. C++ does not use a function keyword by itself, 
and even lesser visibility keywords as PHP does.

I find it rather ugly seeing „public function foo()“ everywhere, when everybody 
knows that parantheses mean function. So, I see readability as a plus.

?php class Foo {
public bar($a, $b) { return $a+$b; }
} ?

It actually is not a drawback, but rather an enhancement that would increase 
PHP’s readability, in my opinion. It could be introduced as „syntactic 
shuggar“, where people can, but dont have to, use the function keyword. For the 
lexer, this just seems to be one more if().

I don’t see a lot of evolution in PHP lately, so something small as this might 
be pretty nice! :)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Mike Willbanks
On Fri, Oct 3, 2014 at 12:57 PM, Ingwie Phoenix ingwie2...@googlemail.com
wrote:


 Am 03.10.2014 um 19:38 schrieb Levi Morrison le...@php.net:

  On Fri, Oct 3, 2014 at 10:21 AM, Thomas Gossmann m...@gossimaniac.net
  wrote:
 
  Hey there,
 
  I'm just a php developer, thus not even having a php.net account.
 
  I was wondering if it is possible to deprecate/remove the function
 keyword
  from class methods in php7 or at least make it optional when one of the
  visibility keywords is present?
 
  I feel like writing a completely unnecessary keyword each time I write a
  new method for a class.
 
  I guess this was a discussion earlier, though I wasn't able to find
  anything about it. Would love to hear, what pdt-internals (re-)think
 about
  that topic.
 
  Thanks,
  gossi
 
 
  Removing the function keyword makes it more difficult for people to find
  method definitions. This has historically been a significant factor in
 why
  this hasn't been done.
 
  Also, what does this change actually bring to the table? There is no
 actual
  benefit to the language or tooling; in fact it probably makes the tooling
  more difficult. All this means is that the user types the function
 keyword
  less and saves a very, very small amount of time.
 
  In summary, historically we have felt that the benefits do not outweigh
 the
  drawbacks.


 I usually just observe on this list, but this is a topic I have come
 across myself.

 PHP has followed the C++ syntax, and logical scoping like namespace,s
 since a long time - if not, eversince. C++ does not use a function keyword
 by itself, and even lesser visibility keywords as PHP does.

 I find it rather ugly seeing „public function foo()“ everywhere, when
 everybody knows that parantheses mean function. So, I see readability as a
 plus.

 ?php class Foo {
 public bar($a, $b) { return $a+$b; }
 } ?

 It actually is not a drawback, but rather an enhancement that would
 increase PHP’s readability, in my opinion. It could be introduced as
 „syntactic shuggar“, where people can, but dont have to, use the function
 keyword. For the lexer, this just seems to be one more if().


I do not really agree with this point, whilst it is possible and creates
more concise structure, it changes a lot of things under the hoods...
Looking for a method and uncertain of the visibility in grep, vim, etc?
Have fun finding it... now you're doing expressions like
/(public|protected|private)\s+methodName/.  So while you saved typing in
function which your WPS as a programmer is quite high.  I doubt it is
going to make much of a difference for you.




 I don’t see a lot of evolution in PHP lately, so something small as this
 might be pretty nice! :)


I don't think you have been watching closely enough, there has been a ton
of evolutions lately...
https://wiki.php.net/rfc#php_70



 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Arvids Godjuks
Hello internals.

I'm firmly against removing the function keyword. PHP is a dynamic
language, that means that even using the latest most functional IDE's out
there, finding the implementation is not always few clicks away (PhpStorm's
Find Usages) and you need to do a search in the project. And the only
thing, that makes it fast and easy, is the function keyword, because you
can do a search by function nameISearchFor and get a single hit.

I'm not even mentioning the code readability...


Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Kris Craig
On Fri, Oct 3, 2014 at 1:00 PM, Arvids Godjuks arvids.godj...@gmail.com
wrote:

 Hello internals.

 I'm firmly against removing the function keyword. PHP is a dynamic
 language, that means that even using the latest most functional IDE's out
 there, finding the implementation is not always few clicks away (PhpStorm's
 Find Usages) and you need to do a search in the project. And the only
 thing, that makes it fast and easy, is the function keyword, because you
 can do a search by function nameISearchFor and get a single hit.

 I'm not even mentioning the code readability...


While there are reasonable arguments to be made for removing it, I agree
that it would create more problems than it would solve.  Specifically, one
of the things I've always liked about PHP is that I can always track down a
particular method declaration in a codebase by simply doing a grep for the
word function preceding the name.  If it's defined in that codebase,
it'll come up.  Even making the keyword optional would eliminate that
certainty and make it that much more difficult to navigate an unfamiliar
codebase.

--Kris


Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Stas Malyshev
Hi!

 Easy to implement, too. What are the list’s thoughts? I don’t think it really 
 hampers readability much.

It's pretty faint praise - doesn't hamper much. I think language
feature should do better than not hurting too much. We don't need to
change things and fragment the language just because we can do it
without hurting too much. Instead, we should think about what it would
improve - and frankly I don't see too much improvement coming out of it.
We've discussed this a number of times, it's not broken, it doesn't need
fixing.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Kalle Sommer Nielsen
Hi

2014-10-03 22:00 GMT+02:00 Arvids Godjuks arvids.godj...@gmail.com:
 Hello internals.

 I'm firmly against removing the function keyword. PHP is a dynamic
 language, that means that even using the latest most functional IDE's out
 there, finding the implementation is not always few clicks away (PhpStorm's
 Find Usages) and you need to do a search in the project. And the only
 thing, that makes it fast and easy, is the function keyword, because you
 can do a search by function nameISearchFor and get a single hit.

 I'm not even mentioning the code readability...

I highly doubt THAT many names properties or constants in paticular
with the same name as a method, and honestly, is it that bad to get a
few extra search results? I think that seems like a very thin argument
against this.

For readablity, the only situration I can think of that can create
some fuzzy is something like this;

abstract class A {
 b();
}

Abstract class with a method and the visibility modifier omitted,
looks like a function call inside a block of code but that is pretty
much about it, but in a non example type of context, even that would
add more readability to that fuzzy example:

abstract class Driver {
 connect($host, $username, $password, $database);
 close();
}

Thats for saying, I'm not against removing it, but I'm not in hugely
favor for doing so either, lets call that neutral.



-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Arvids Godjuks
04 окт. 2014 г. 1:03 пользователь Kalle Sommer Nielsen ka...@php.net
написал:

 Hi

 2014-10-03 22:00 GMT+02:00 Arvids Godjuks arvids.godj...@gmail.com:
  Hello internals.
 
  I'm firmly against removing the function keyword. PHP is a dynamic
  language, that means that even using the latest most functional IDE's
out
  there, finding the implementation is not always few clicks away
(PhpStorm's
  Find Usages) and you need to do a search in the project. And the only
  thing, that makes it fast and easy, is the function keyword, because
you
  can do a search by function nameISearchFor and get a single hit.
 
  I'm not even mentioning the code readability...

 I highly doubt THAT many names properties or constants in paticular
 with the same name as a method, and honestly, is it that bad to get a
 few extra search results? I think that seems like a very thin argument
 against this.

 For readablity, the only situration I can think of that can create
 some fuzzy is something like this;

 abstract class A {
  b();
 }

 Abstract class with a method and the visibility modifier omitted,
 looks like a function call inside a block of code but that is pretty
 much about it, but in a non example type of context, even that would
 add more readability to that fuzzy example:

 abstract class Driver {
  connect($host, $username, $password, $database);
  close();
 }

 Thats for saying, I'm not against removing it, but I'm not in hugely
 favor for doing so either, lets call that neutral.



 --
 regards,

 Kalle Sommer Nielsen
 ka...@php.net

I really have to ask, did you work with really big projects? Like really
sizeable.


Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Kalle Sommer Nielsen
2014-10-04 0:06 GMT+02:00 Arvids Godjuks arvids.godj...@gmail.com:
 I really have to ask, did you work with really big projects? Like really
 sizeable.

Yes I have and I deal with it, instead of going into grindy small
details about how the code looks like, I work with it and can quickly
adapt to the project I work on no matter the size of the project. Sure
I can understand that some may not be as agile, but that is not a
reason to flawlessly deny this.

It is like saying lets not add the 'or' and 'and' keywords because we
already have '||' and '', it is a shortcut for those who choose to
use it and I have often thought it would be nice to make the keyword
optional myself, but as I said I'm fairly neutral here so I have not
bothered to take it further.



-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Sara Golemon
On Fri, Oct 3, 2014 at 10:21 AM, Thomas Gossmann m...@gossimaniac.net wrote:
 I was wondering if it is possible to deprecate/remove the function keyword
 from class methods in php7 or at least make it optional when one of the
 visibility keywords is present?

No.

On Fri, Oct 3, 2014 at 6:57 PM, Ingwie Phoenix
ingwie2...@googlemail.com wrote:
 I don’t see a lot of evolution in PHP lately

Pay closer attention.

-Sara

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods?

2014-10-03 Thread Eli
On 10/3/14 4:57 PM, Andrea Faulds wrote:
 Easy to implement, too. What are the list’s thoughts? I don’t think it really 
 hampers readability much.


I disagree.  This is a case where verbosity is a good thing.  Removing
the word 'function' is akin (pardon the analogy) to arguing the $x is
just as good of a variable name as $database.

The latter is descriptive and explains exactly what is going on.  While
the shortened version, only saves a few keystrokes, which an IDE solves
for you anyway.  And makes it much more clear (when grepping, for
tooling, when scanning) exactly what/where/how the functions are declared.

Eli

-- 
|   Eli White   |   http://eliw.com/   |   Twitter: EliW   |




signature.asc
Description: OpenPGP digital signature