Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15525
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: PHP7 Stack Trace Mess |
| Date | 2015-06-25 15:48 +0200 |
| Organization | solani.org |
| Message-ID | <mmh0rk$gj$1@solani.org> (permalink) |
| References | (7 earlier) <87r3p13rmn.fsf@ahungry.com> <mmeu5v$ibm$1@news.albasani.net> <mmfdas$5g7$1@solani.org> <87mvzo4jtr.fsf@ahungry.com> <mmgchq$cf2$1@news.albasani.net> |
Thomas Mlynarczyk wrote:
> On 25/06/15 04:12, Matthew Carter wrote:
>> Hm, so with new strict type scalar hints it is turned on via per file
>> (not global) basis, and whether something is strict or not is dependent
>> on the declare being in the file that makes calls to the functions, not
>> the file that defines the functions.
>>
>> Doesn't that seem sort of weird?
It is the only way to let the user (opposed to library developers)
decide whether weak or strict type checking should be applied.
> It's PHP, what did you expect? Instead of simply regarding
>
> function foo ( int $arg ) { /* ... */ }
>
> as the equivalent of
>
> function foo ( $arg ) {
> if ( !is_int( $arg ) throw new InvalidArgumentException( ... );
> /* ... */
> }
Basically, that is how strict typing works.
> they had to invent problems where there are none. Yes, reasons are given
> in the relevant RFC, but they are not at all convincing to me.
Well, you'll want to consider the background. "Everybody" wanted scalar
type hints, but no broad consensus could be achieved regarding the
semantics (strict vs. weak). The Scalar Type Declarations RFC is a
compromise trying to satisfy most developers.
Apparently, you're in favor of strict type hints, but I am not, because
it would be a pretty big change in how PHP works, and also there are
some weird edge cases, e.g.:
<?php
declare(strict_types=1);
$num = 1 << 32;
$num *= $num;
echo dechex($num);
What's the output?
--
Christoph M. Becker
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PHP7 Stack Trace Mess Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-06-23 16:28 +0200
Re: PHP7 Stack Trace Mess Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2015-06-23 16:58 +0000
Re: PHP7 Stack Trace Mess "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-23 20:00 +0200
Re: PHP7 Stack Trace Mess Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-06-23 22:22 +0200
Re: PHP7 Stack Trace Mess "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-24 00:03 +0200
Re: PHP7 Stack Trace Mess Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-06-24 10:44 +0200
Re: PHP7 Stack Trace Mess "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-24 20:02 +0200
Re: PHP7 Stack Trace Mess Matthew Carter <m@ahungry.com> - 2015-06-24 14:09 -0400
Re: PHP7 Stack Trace Mess Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-06-24 20:50 +0200
Re: PHP7 Stack Trace Mess "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-25 01:09 +0200
Re: PHP7 Stack Trace Mess Matthew Carter <m@ahungry.com> - 2015-06-24 22:12 -0400
Re: PHP7 Stack Trace Mess Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-06-25 10:02 +0200
Re: PHP7 Stack Trace Mess "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-25 15:48 +0200
Re: PHP7 Stack Trace Mess Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-06-25 18:04 +0200
Re: PHP7 Stack Trace Mess "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-25 19:14 +0200
Re: PHP7 Stack Trace Mess Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2015-06-23 22:07 +0200
Re: PHP7 Stack Trace Mess "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-23 22:15 +0200
Re: PHP7 Stack Trace Mess Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2015-06-24 06:13 +0000
csiph-web