RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Ford, Mike | Date: | Tue, 15 Jul 2014 12:12:13 +0000 |
| Subject: | RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75533@lists.php.net to get a copy of this message | ||
Oh, goodness, deary me -- this sounded so familiar I just had to do some delving and hey presto! I
refer you to: http://marc.info/?l=php-internals&m=124655821522388
(...which, interestingly, even predates Zeev's 2010 claim, and I believe may have taken
inspiration from yet earlier suggestions back around 2006!!)
--
Mike Ford, Electronic Information Developer, Libraries and Learning Innovation
Leeds Metropolitan University, 403a Sheila Silver Library, Leslie Silver Building, City Campus,
Leeds LS1 3ES, United Kingdom
Tel: +44 113 812 4730 | Email: m.ford@leedsmet.ac.uk
> -----Original Message-----
> From: Jocelyn Fournier [mailto:jocelyn.fournier@gmail.com]
> Sent: 14 July 2014 14:30
> To: narf@devilix.net
> Cc: internals@lists.php.net; indeyets@gmail.com; Andrea Faulds
> Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-
> opening)
>
> Hi,
>
> Le 14/07/2014 15:19, Andrey Andreev a écrit :
> > Hi,
> >
> > On Mon, Jul 14, 2014 at 4:12 PM, Alexey Zakhlestin
> <indeyets@gmail.com> wrote:
> >> Some people talk about inconsistency, which is introduced by
> reusing same syntax for "strict parameter types" and "scalar
> parameter casts”. There’s some truth there.
> >> Let’s use different syntax.
> >>
> >> This might work:
> >>
> >> function foo((int) $a)
> >> {
> >> var_dump($a);
> >> }
> >>
> >> I would read it as declaration-level casting
> >
> > I strongly support this.
> >
> > What we currently have with class/array typing is a different
> behavior
> > (regardless of the details behind it), and this syntax would make
> that
> > noticeable, which is a great thing.
>
> Actually both syntax could exists :
>
> function foo((int) $a)
> {
>
> => scalar parameter casts syntax
>
>
> function foo(int $a)
> {
>
> => strict type checking syntax (consistant with array / class
> syntax)
>
>
> I like this approach as well.
>
>
> Jocelyn
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
From 22 September 2014 Leeds Metropolitan University will become Leeds Beckett University.
Find out more at http://www.leedsbeckett.ac.uk
To view the terms under which this email is distributed, please go to:-
http://www.leedsmet.ac.uk/email-disclaimer.htm