# [RFC] [VOTE] Short Closures

- Thread: https://externals.io/message/88394
- Original archive: https://news-web.php.net/php.internals/88394
- Started by Bob Weinand on 2015-09-22T01:59:56+00:00
- Messages: 41
- RFC: Short Closures 2.0 (Declined) — https://externals.io/rfc/auto-capture-closure.md
- RFC: Short Closures (~> operator) (Withdrawn) — https://externals.io/rfc/short_closures.md
- Page 1 of 2: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/88394.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #88394 — Bob Weinand — 2015-09-22T01:59:56+00:00

URL: https://externals.io/message/88394#88394

Hey,

Thanks for all your feedback in the discussion thread!

So, before I start the vote, just two quick notes:
I've added two notes about the statement syntax and the single variable use.
Though a few people complained, I'm not switching to the ==> operator, as I noticed many people expected typehints to work (they don't due to parser limitations) when they compared to Hack's short Closures. It also allows us to differ syntax-wise [e.g. for typehints] from Hack without causing any confusion later. Which should be the smartest choice: Avoid conflicts. (If anyone strongly feels against that, he may vote no, but I would like to not bikeshed that in this Vote thread, but leave it free for eventual actual issues.)

Now, the link to the RFC about Short Closures:
https://wiki.php.net/rfc/short_closures
or straight ahead to the vote:
https://wiki.php.net/rfc/short_closures#vote

Thanks,
Bob

---

## #88399 — Dmitry Stogov — 2015-09-22T08:25:46+00:00

URL: https://externals.io/message/88394#88399 · In reply to: #88394

I'm against the magic - "automatically use () all of the (compiled)
variables".
I'm also against compound short closures with curly brackets.
in my opinion they opens too many ambiguous questions.

function foo() {
  (($x) ~> {$y = 3; return $y + $x;})(5);
  return $y;
}

also think about nested closures and use of variables from not direct
enclosure.

I'm not sure if we need all "functional programming" features in PHP, but
if we introduce them, lets do it consistently with the existing language.
I think, this proposal can't be approved without support for type hinting.

Thanks. Dmitry.



> Hey,
>
> Thanks for all your feedback in the discussion thread!
>
> So, before I start the vote, just two quick notes:
> I've added two notes about the statement syntax and the single variable
> use.
> Though a few people complained, I'm not switching to the ==> operator, as
> I noticed many people expected typehints to work (they don't due to parser
> limitations) when they compared to Hack's short Closures. It also allows us
> to differ syntax-wise [e.g. for typehints] from Hack without causing any
> confusion later. Which should be the smartest choice: Avoid conflicts. (If
> anyone strongly feels against that, he may vote no, but I would like to not
> bikeshed that in this Vote thread, but leave it free for eventual actual
> issues.)
>
> Now, the link to the RFC about Short Closures:
> https://wiki.php.net/rfc/short_closures
> or straight ahead to the vote:
> https://wiki.php.net/rfc/short_closures#vote
>
> Thanks,
> Bob

---

## #88400 — Peter Petermann — 2015-09-22T08:42:21+00:00

URL: https://externals.io/message/88394#88400 · In reply to: #88394

Hi,

The introduction claims:

"he current implementation of anonymous functions in PHP is quite verbose
compared to other languages. That makes using anonymous functions be more
difficult than it could be, as there is both more to type, and more
importantly the current implementation makes it hard to read (and so
maintain) code that uses anonymous functions."

I personally feel that the "verbosity" of the way PHP is doing closures at
the moment is a good thing. It is much more readable and clear what is
happening than with ~>.
I further believe that the automatic binding of variables creates a lot
*less* clear and maintainable code, easy to be misunderstood and prone for
mistakes.

Which to me means the Proposal is actually doing the opposite of what it
claims to improve.

hence, i voted against it.

regards,
Peter Petermann

---

## #88405 — Joe Watkins — 2015-09-22T13:54:41+00:00

URL: https://externals.io/message/88394#88405 · In reply to: #88399

I'd really like to understand what you're trying to say there Dmitry, but I
don't get it.

What is your example function trying to show ?

As it mentions in the RFC, vars in short closure are by-value, so I can't
see what side effects you might be thinking of ?

Cheers
Joe



> I'm against the magic - "automatically use () all of the (compiled)
> variables".
> I'm also against compound short closures with curly brackets.
> in my opinion they opens too many ambiguous questions.
>
> function foo() {
>   (($x) ~> {$y = 3; return $y + $x;})(5);
>   return $y;
> }
>
> also think about nested closures and use of variables from not direct
> enclosure.
>
> I'm not sure if we need all "functional programming" features in PHP, but
> if we introduce them, lets do it consistently with the existing language.
> I think, this proposal can't be approved without support for type hinting.
>
> Thanks. Dmitry.
>
> 
>
> > […]
> parser
> > […]
> us
> > […]
> (If
> > […]
> not
> > […]

---

## #88409 — Andrea Faulds — 2015-09-22T15:16:08+00:00

URL: https://externals.io/message/88394#88409 · In reply to: #88394

Hi Bob,

Bob Weinand wrote:
> Hey,
>
> Thanks for all your feedback in the discussion thread!
>
> So, before I start the vote, just two quick notes:
> I've added two notes about the statement syntax and the single variable use.
> Though a few people complained, I'm not switching to the ==> operator, as I noticed many people expected typehints to work (they don't due to parser limitations) when they compared to Hack's short Closures. It also allows us to differ syntax-wise [e.g. for typehints] from Hack without causing any confusion later. Which should be the smartest choice: Avoid conflicts. (If anyone strongly feels against that, he may vote no, but I would like to not bikeshed that in this Vote thread, but leave it free for eventual actual issues.)
>
> Now, the link to the RFC about Short Closures:
> https://wiki.php.net/rfc/short_closures
> or straight ahead to the vote:
> https://wiki.php.net/rfc/short_closures#vote

I am unhappy with the ~> syntax choice. As I've mentioned before, it's 
hard to type for many people, it looks too much like ->, and it's 
unnecessarily different from Hack's ==>, of which this RFC would 
otherwise be proposing a strict subset.

So, I am voting against.

Thanks.

-- 
Andrea Faulds
http://ajf.me/

---

## #88410 — Dmitry Stogov — 2015-09-22T15:36:32+00:00

URL: https://externals.io/message/88394#88410 · In reply to: #88405

> I'd really like to understand what you're trying to say there Dmitry, but
> I don't get it.
>
> What is your example function trying to show ?
>
> As it mentions in the RFC, vars in short closure are by-value, so I can't
> see what side effects you might be thinking of ?
>

It's clear to me that foo() will return NULL, but how many warnings about
unused variable $y will we get?

Thanks. Dmitry.


>
> Cheers
> Joe
>
> 
>
> > […]

---

## #88411 — Bob Weinand — 2015-09-22T16:01:43+00:00

URL: https://externals.io/message/88394#88411 · In reply to: #88410

> Am 22.09.2015 um 17:36 schrieb Dmitry Stogov <dmitry@zend.com>:
> 
> 
> 
> > […]
> 
> It's clear to me that foo() will return NULL, but how many warnings about
> unused variable $y will we get?
> 
> Thanks. Dmitry.
> 
> 
> > […]


Notice: Undefined variable: y in php shell code on line 3

It just yields exactly one notice about the inexistent $y (as it obviously does not leak through the scope): by-value binding.

I'm not sure what your issue here is?

Bob

---

## #88414 — Dmitry Stogov — 2015-09-22T18:05:54+00:00

URL: https://externals.io/message/88394#88414 · In reply to: #88411

>
> > […]
> wrote:
> > […]
> but
> > […]
> can't
> > […]
> but
> > […]
> language.
> > […]
> hinting.
> > […]
> wrote:
> > […]
> variable
> > […]
> any
> > […]
> to
> > […]
> actual
> > […]
>
>
> Notice: Undefined variable: y in php shell code on line 3
>
> It just yields exactly one notice about the inexistent $y (as it obviously
> does not leak through the scope): by-value binding.
>
> I'm not sure what your issue here is?
>

The current PHP version emits two warning on similar constructs, and this
is explainable because we explicitly "use" $y.

$ sapi/cli/php -r 'function foo(){(function($x) use ($y){$y=3; return
$y+$x;})(5);return $y;} var_dump(foo());'
PHP Notice:  Undefined variable: y in Command line code on line 1

PHP Notice:  Undefined variable: y in Command line code on line 1

 `NULL` 

Thanks. Dmitry.


>
> Bob

---

## #88416 — Anthony Ferrara — 2015-09-22T18:20:05+00:00

URL: https://externals.io/message/88394#88416 · In reply to: #88414

Dmitry,


> 
>
> > […]
>
> The current PHP version emits two warning on similar constructs, and this
> is explainable because we explicitly "use" $y.
>
> $ sapi/cli/php -r 'function foo(){(function($x) use ($y){$y=3; return
> $y+$x;})(5);return $y;} var_dump(foo());'
> PHP Notice:  Undefined variable: y in Command line code on line 1
>
> PHP Notice:  Undefined variable: y in Command line code on line 1
>
> `NULL` 
>

There's an important distinction here. The explicit `use($y)` triggers
a notice because you said to use an undefined variable.

function foo() {
  (($x) ~> {$y = 3; return $y + $x;})(5);
  return $y;
}

In this case, there's no practical binding of `$y` at all. The `$y` in
the scope of the closure is never actually read from before it is
assigned to. Meaning the variable doesn't need to exist prior to that
assignment, meaning that it doesn't have to be bound (used), and as
such shouldn't throw a notice.

This becomes a ton easier if we ever move to an explicit CFG+SSA
compile step. Then, we can see which variables dominate the closure to
see what needs to be bound vs what doesn't. In this example, converted
to SSA, you'd see:

function foo() {
  $y1 = 12;
  (($x1) ~> {$y2 = 3; return $y2 + $x1;})(5);
  return $y1;
}

Hence you can see that `$y2` is truly an independent variable, and
hence `$y1` never needs to be bound (and hence no notice).

So your case of explicitly using `$y` isn't actually what's happening
with the closure (at least with respect to userland behavior). Hence
why the lack of notice exists.

My $0.02 at least,

Anthony

---

## #88417 — Bob Weinand — 2015-09-22T18:24:33+00:00

URL: https://externals.io/message/88394#88417 · In reply to: #88414

> Am 22.09.2015 um 20:05 schrieb Dmitry Stogov <dmitry@zend.com>:
> 
> The current PHP version emits two warning on similar constructs, and this
> is explainable because we explicitly "use" $y.
> 
> $ sapi/cli/php -r 'function foo(){(function($x) use ($y){$y=3; return
> $y+$x;})(5);return $y;} var_dump(foo());'
> PHP Notice:  Undefined variable: y in Command line code on line 1
> 
> PHP Notice:  Undefined variable: y in Command line code on line 1
> 
> `NULL` 
> 
> Thanks. Dmitry.

Well, yes. But that obviously needs alternate handling here as we don't have full analysis to look at whether we'd need to import or not. Hence we just are importing everything if it's used in Closure scope and defined in parent scope.

Because we obviously don't want this to emit a notice:

function foo() {
    return ($x ~> {
        $y = 2;
        return $x + $y;
    })(10);
}

Else it'd be totally impossible to define any variables...

Also, the long form sets $y to `NULL` in the Closure (we just have two notices there because you return $y; too… if you remove that, you'll be left with just one notice.

Bob

---

## #88418 — Dmitry Stogov — 2015-09-22T19:19:27+00:00

URL: https://externals.io/message/88394#88418 · In reply to: #88416

On Tue, Sep 22, 2015 at 9:20 PM, Anthony Ferrara <ircmaxell@gmail.com>
wrote:

> Dmitry,
>
> 
> > […]
> wrote:
> > […]
> about
> > […]
> wrote:
> > […]
> direct
> > […]
> PHP,
> > […]
> operator,
> > […]
> causing
> > […]
> conflicts.
> > […]
> like
> > […]
> obviously
> > […]
>
> There's an important distinction here. The explicit `use($y)` triggers
> a notice because you said to use an undefined variable.
>
> function foo() {
>   (($x) ~> {$y = 3; return $y + $x;})(5);
>   return $y;
> }
>
> In this case, there's no practical binding of `$y` at all. The `$y` in
> the scope of the closure is never actually read from before it is
> assigned to. Meaning the variable doesn't need to exist prior to that
> assignment, meaning that it doesn't have to be bound (used), and as
> such shouldn't throw a notice.
>

This is not the way like PHP works and the proposed patch didn't change
this.
It produced warning on "implicit" use.
Now Bob seems to fixed this by hiding the warning.


>
> This becomes a ton easier if we ever move to an explicit CFG+SSA
> compile step. Then, we can see which variables dominate the closure to
> see what needs to be bound vs what doesn't. In this example, converted
> to SSA, you'd see:
>
> function foo() {
>   $y1 = 12;
>   (($x1) ~> {$y2 = 3; return $y2 + $x1;})(5);
>   return $y1;
> }
>
> Hence you can see that `$y2` is truly an independent variable, and
> hence `$y1` never needs to be bound (and hence no notice).
>
> So your case of explicitly using `$y` isn't actually what's happening
> with the closure (at least with respect to userland behavior). Hence
> why the lack of notice exists.
>
> My $0.02 at least,
>

This is interesting, and I also thought about this.
But this is going to be different language with different rules.
Also, this approach can't handle all possible cases in dynamic languages,
where we can't say if variable is used or assigned first.

function foo() {
  $y = 1;
  $f = ($x) ~> {
    for ($i = 0; $i < 2; $i++) {
       if ($x) {
         $y = 5;
       } else {
         echo $y
       }
   };
  $f(0);
  $f(1);
}

Your approach won't be able to determine if $y in short closure is local
variable or from function foo().
Anyway, this is not related to Bob's proposal.

Thanks. Dmitry.


>
> Anthony

---

## #88419 — Dmitry Stogov — 2015-09-22T19:24:34+00:00

URL: https://externals.io/message/88394#88419 · In reply to: #88417

>
> Am 22.09.2015 um 20:05 schrieb Dmitry Stogov <dmitry@zend.com>:
>
> The current PHP version emits two warning on similar constructs, and this
> is explainable because we explicitly "use" $y.
>
> $ sapi/cli/php -r 'function foo(){(function($x) use ($y){$y=3; return
> $y+$x;})(5);return $y;} var_dump(foo());'
> PHP Notice:  Undefined variable: y in Command line code on line 1
>
> PHP Notice:  Undefined variable: y in Command line code on line 1
>
> `NULL` 
>
> Thanks. Dmitry.
>
>
> Well, yes. But that obviously needs alternate handling here as we don't
> have full analysis to look at whether we'd need to import or not. Hence we
> just are importing everything if it's used in Closure scope and defined in
> parent scope.
>
> Because we obviously don't want this to emit a notice:
>
> function foo() {
>     return ($x ~> {
>         $y = 2;
>         return $x + $y;
>     })(10);
> }
>
> Else it'd be totally impossible to define any variables...
>
> Also, the long form sets $y to `NULL` in the Closure (we just have two
> notices there because you return $y; too… if you remove that, you'll be
> left with just one notice.
>

I saw, you have fixed that warning on implicit use.

Thanks. Dmitry.


>
> Bob

---

## #88423 — Anthony Ferrara — 2015-09-22T21:00:11+00:00

URL: https://externals.io/message/88394#88423 · In reply to: #88418

Dmitry,


>
>
> On Tue, Sep 22, 2015 at 9:20 PM, Anthony Ferrara <ircmaxell@gmail.com>
> wrote:
> > […]
>
>
> This is not the way like PHP works and the proposed patch didn't change
> this.
> It produced warning on "implicit" use.
> Now Bob seems to fixed this by hiding the warning.
>
> > […]
>
>
> This is interesting, and I also thought about this.
> But this is going to be different language with different rules.
> Also, this approach can't handle all possible cases in dynamic languages,
> where we can't say if variable is used or assigned first.
>
> function foo() {
>   $y = 1;
>   $f = ($x) ~> {
>     for ($i = 0; $i < 2; $i++) {
>        if ($x) {
>          $y = 5;
>        } else {
>          echo $y
>        }
>    };
>   $f(0);
>   $f(1);
> }
>
> Your approach won't be able to determine if $y in short closure is local
> variable or from function foo().
> Anyway, this is not related to Bob's proposal.

Yes it can. Because the usages of `$y` are not fully dominated by an
assignment, there is at least one path from `$y = 1` to `echo $y` that
exists (this is trivial to prove). Hence the binding would need to
happen (no matter if that path was chosen by the actual execution
path).

Variable-variables would need to be taken into account, but that would
be easy to solve by saying if we see a Var-Var usage, bind everything
unless we can prove the variable is dominated inside the lambda.

And this is related to Bob's proposal in a way. Right now, he has to
bind every symbol that exists in the closure using a non-notice read
(if it exists in the parent, bind, otherwise don't notice). The point
I was making is that if we modify our compiler it can get even
smarter, reducing the cases where we over-bind (and thereby making it
more efficient). Considering that some people are concerned around the
performance implications of the binding, possible solutions to that
problem do exist and could be implemented.

Anthony

---

## #88424 — Dmitry Stogov — 2015-09-22T22:04:56+00:00

URL: https://externals.io/message/88394#88424 · In reply to: #88423

On Wed, Sep 23, 2015 at 12:00 AM, Anthony Ferrara <ircmaxell@gmail.com>
wrote:

> Dmitry,
>
> 
> > […]
> pthreads@pthreads.org>
> > […]
> I
> > […]
> (compiled)
> > […]
> bobwei9@hotmail.com>
> > […]
> also
> > […]
> eventual
> > […]
>
> Yes it can. Because the usages of `$y` are not fully dominated by an
> assignment, there is at least one path from `$y = 1` to `echo $y` that
> exists (this is trivial to prove). Hence the binding would need to
> happen (no matter if that path was chosen by the actual execution
> path).
>

So if we have at least one path that assumes use before local assignment we
will use variable from the upper context.
This should work.

What if upper function doesn't have such variable? should it be created or
should we use local instead?

What if the upper context is global and at compile-time we don't know if
used variable exists or not?

I think, we may collect all variables of lambda that may be used before
initialized at compile-time.
At runtime we may check if upper syntax context (or even contexts) define
required vars and bind them.
This probably may work for binding by value. Use by reference will still
require explicit definition.
I don't think we can implement this in PHP (big conceptual change).

Variable-variables would need to be taken into account, but that would
> be easy to solve by saying if we see a Var-Var usage, bind everything
> unless we can prove the variable is dominated inside the lambda.
>

var-var, eval(), references and aliases make huge troubles for compile-time
decisions :(


>
> And this is related to Bob's proposal in a way. Right now, he has to
> bind every symbol that exists in the closure using a non-notice read
> (if it exists in the parent, bind, otherwise don't notice). The point
> I was making is that if we modify our compiler it can get even
> smarter, reducing the cases where we over-bind (and thereby making it
> more efficient). Considering that some people are concerned around the
> performance implications of the binding, possible solutions to that
> problem do exist and could be implemented.
>

In general, this is possible, but SSA construction is much more difficult
than the proposed by Bob patch.

Thanks. Dmitry.

>
> Anthony

---

## #88432 — Tony Marston — 2015-09-23T09:25:39+00:00

URL: https://externals.io/message/88394#88432 · In reply to: #88423

"Anthony Ferrara"  wrote in message 
news:CAAyV7nHVNGG8yOyGhTE=pKACi4GDTgrdVcS4RDXb2fLmNy4Zpg@mail.gmail.com...
>
>Dmitry,
>
>
> > […]
>
>Yes it can. Because the usages of `$y` are not fully dominated by an
>assignment, there is at least one path from `$y = 1` to `echo $y` that
>exists (this is trivial to prove). Hence the binding would need to
>happen (no matter if that path was chosen by the actual execution
>path).
>
>Variable-variables would need to be taken into account, but that would
>be easy to solve by saying if we see a Var-Var usage, bind everything
>unless we can prove the variable is dominated inside the lambda.
>
>And this is related to Bob's proposal in a way. Right now, he has to
>bind every symbol that exists in the closure using a non-notice read
>(if it exists in the parent, bind, otherwise don't notice). The point
>I was making is that if we modify our compiler it can get even
>smarter, reducing the cases where we over-bind (and thereby making it
>more efficient). Considering that some people are concerned around the
>performance implications of the binding, possible solutions to that
>problem do exist and could be implemented.
>
>Anthony

The more I read of this thread the more I think that it is a totally bad 
idea. If a single line of code requires a whole page to describe what it 
does, and even then there is a great deal of confusion between different 
people, then I would class that line of code as "unreadable". By this I mean 
that if I cannot determine within 5 seconds what a line of code does with 
complete accuracy then it becomes a maintenance nightmare. The objective of 
"good" programming is NOT to write code with as few keystrokes as possible, 
it is, as Abelson and Sussman wrote in 1944, "Programs must be written for 
people to read, and only incidentally for machines to execute". Martin 
Fowler, the author of Patterns of Enterprise Application Architecture, wrote 
"Any fool can write code that a computer can understand. Good programmers 
write code that humans can understand. "

Please please please STOP with this nonsense about writing small amounts of 
clever code and stick with writing simple but readable code. I would much 
rather see 5 separate instructions on 5 separate lines than 5 instructions 
squeezed into a single line. IMHO the readability of a piece of code is 
directly proportional to the number of keystrokes used to write it. In other 
words, less keystrokes equals less readability.

-- 
Tony Marston

---

## #88461 — Pierre Joye — 2015-09-24T06:27:14+00:00

URL: https://externals.io/message/88394#88461 · In reply to: #88409

>

> I am unhappy with the ~> syntax choice. As I've mentioned before, it's
hard to type for many people, it looks too much like ->, and it's
unnecessarily different from Hack's ==>, of which this RFC would otherwise
be proposing a strict subset.
>
> So, I am voting against.

Same reason here.

Thanks,
Pierre

---

## #88462 — Marco Pivetta — 2015-09-24T06:39:32+00:00

URL: https://externals.io/message/88394#88462 · In reply to: #88461

Changed my vote to "no" after thinking further into it:

 - I don't like the usage of the tilde: `->` and `~>` are too similar and
easily confused
 - Using `==>` would align PHP further to hacklang, which is a plus
 - I'm still conflicted on automatically importing all of the scope into
the closure: while it is working for functional languages, that's where
most of the headaches come from in languages such as javascript.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/



> 
> > […]
>
> > […]
> hard to type for many people, it looks too much like ->, and it's
> unnecessarily different from Hack's ==>, of which this RFC would otherwise
> be proposing a strict subset.
> > […]
>
> Same reason here.
>
> Thanks,
> Pierre

---

## #88463 — Julien BENOIT — 2015-09-24T07:03:44+00:00

URL: https://externals.io/message/88394#88463 · In reply to: #88462

Hi,

As a PHP developer, I agree with the possible confusion between `->` and
`~>`.
`==>` is a better choice IMHO, for its similarity with Hacklang syntax, as
said previously.

Thanks.

*Julien BENOIT*
*PHP & JS developer @GuestToGuest <https://twitter.com/GuestToGuest>*
Paris, FR.
blog.julienbenoit.net
  <http://fr.linkedin.com/in/jbenoit2011>
<http://www.viadeo.com/profile/0021vk9j4z60jp63/>
<https://github.com/jbenoit2011>

2015-09-24 8:39 GMT+02:00 Marco Pivetta <ocramius@gmail.com>:

> Changed my vote to "no" after thinking further into it:
>
>  - I don't like the usage of the tilde: `->` and `~>` are too similar and
> easily confused
>  - Using `==>` would align PHP further to hacklang, which is a plus
>  - I'm still conflicted on automatically importing all of the scope into
> the closure: while it is working for functional languages, that's where
> most of the headaches come from in languages such as javascript.
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
> 
>
> > […]
> otherwise
> > […]

---

## #88464 — Lester Caine — 2015-09-24T07:06:49+00:00

URL: https://externals.io/message/88394#88464 · In reply to: #88462

>  - I'm still conflicted on automatically importing all of the scope into
> the closure: while it is working for functional languages, that's where
> most of the headaches come from in languages such as javascript.

Isn't this the crux of some decisions? Once one adopts compiling as an
essential step a number of the rules can be changed. So is PHP heading
down the path of a compiled language even if that is hidden in some
automatic cache or is it still mainly an interpreted script? Lots of
things are easier if you apply optimization in the compile stage but
that then blocks many of the dynamic actions which PHP *IS* so good at.
The sort of thing that allows thousands of pages of content to be stored
in a database without some of the straight jacket that some people seem
to think is essential these days?

If I'd wanted a fully compiled system I'd have stayed with C/C++ all
those years ago ... as I keep harping on PHPs dynamic nature is it's
strength?

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

---

## #88465 — Stanislav Malyshev — 2015-09-24T07:10:58+00:00

URL: https://externals.io/message/88394#88465 · In reply to: #88463

Hi!

> As a PHP developer, I agree with the possible confusion between `->` and
> `~>`.
> `==>` is a better choice IMHO, for its similarity with Hacklang syntax, as
> said previously.

I'm getting a feeling the RFC could be more successful if syntax was
made a choice between ~> and ==> as a voting option.
-- 
Stas Malyshev
smalyshev@gmail.com

---

## #88466 — Pierre Joye — 2015-09-24T07:51:25+00:00

URL: https://externals.io/message/88394#88466 · In reply to: #88465

>
> Hi!
>
> > […]
as
> > […]
>
> I'm getting a feeling the RFC could be more successful if syntax was
> made a choice between ~> and ==> as a voting option.

Yes, given we do not have issues with the use (which seems to be cleared
now)

> Stas Malyshev
> smalyshev@gmail.com

---

## #88472 — Rowan Collins — 2015-09-24T10:13:27+00:00

URL: https://externals.io/message/88394#88472 · In reply to: #88464

Lester Caine wrote on 24/09/2015 08:06:
> So is PHP heading
> down the path of a compiled language even if that is hidden in some
> automatic cache or is it still mainly an interpreted script?

PHP already is a compiled language; it just has a highly dynamic runtime 
engine (which is at times a blessing, and at times a curse).

---

## #88473 — bjorn.x.larsson@telia.com — 2015-09-24T10:57:10+00:00

URL: https://externals.io/message/88394#88473 · In reply to: #88465

Den 2015-09-24 kl. 09:10, skrev Stanislav Malyshev:
> Hi!
>
> > […]
> I'm getting a feeling the RFC could be more successful if syntax was
> made a choice between ~> and ==> as a voting option.
How does one then address that this RFC only covers a subset of
Hacklang functionality when having the same operator?

--

//Björn Larsson

---

## #88474 — Jordi Boggiano — 2015-09-24T13:08:14+00:00

URL: https://externals.io/message/88394#88474 · In reply to: #88462

>   - I'm still conflicted on automatically importing all of the scope into
> the closure: while it is working for functional languages, that's where
> most of the headaches come from in languages such as javascript.

The automatic import IMO isn't as much an issue as in JS, because it 
imports by value and not by reference as is done in JS. If you do $foo = 
'bar'; in your closure and suddenly someone in the outer scope defines 
$foo as well, you aren't going to overwrite that outer scope value. 
Therefore the risks for interferences are reduced quite a bit.

Cheers

-- 
Jordi Boggiano
@seldaek - http://seld.be

---

## #88479 — Stanislav Malyshev — 2015-09-24T18:21:20+00:00

URL: https://externals.io/message/88394#88479 · In reply to: #88473

Hi!

> How does one then address that this RFC only covers a subset of
> Hacklang functionality when having the same operator?

Why one should address it? PHP is a different language, and we are under
no obligation to completely match functionality of any other language.

-- 
Stas Malyshev
smalyshev@gmail.com

---

Next page: https://externals.io/message/88394.md?page=2
