Re: Function list declaration syntax?

From: Date: Sat, 09 Oct 2021 09:41:18 +0000
Subject: Re: Function list declaration syntax?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-116255@lists.php.net to get a copy of this message
> On Oct 5, 2021, at 3:18 PM, Dan Ackroyd <Danack@basereality.com> wrote:
> 
> On Tue, 5 Oct 2021 at 18:47, Mike Schinkel <mike@newclarity.net> wrote:
> 
>> Consider the Type class[3] in the SebastianBergmann\Type
>> namespace. It contains 60 lines of function declaration to define 14 functions that all return
>> false.
> 
> PHP allows you to define functions on one line:
> 
>    function isCallable(): bool { return false; }
>    function isFalse(): bool { return false; }
>    function isGenericObject(): bool { return false; }

The benefit I was proposing was not just fewer lines, but also reduced visual complexity making it
easier to read and comprehend code quickly. 

Your argument addresses the former benefit but not the latter.

> If you don't like having functions take up lots of lines, it's easier
> to just not follow that PSR guide line on formatting,

It is not always easier for developers where whose organizations dictate code standards.

Besides, your alternative is a bit reductio ad absurdum.

> rather than modify the language.

You state this without justification that it has been established that changing the language is a
bad thing. If that were true, why does the RFC process even exist as in most cases RFCs are passed
to change the language?

-Mike


Thread (4 messages)

« previous php.internals (#116255) next »