ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
RE: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
by Andi Gutmans other posts by this author
Jun 18 2008 11:13AM messages near this date
Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP | Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
Hi Christian,

Thanks for the clarifications. This helped a lot and makes me feel very confident about this
 implementation. I think this is a very strong proposal.

A few additional things I thought about while taking a closer look:
- You mention "global" and "static" as examples of how we do things today. They are actually
 not good examples because the binding by reference which they do has been a real pain over 
the years. This is why we introduced the $GLOBALS[] array so that you could also assign by r
eference ($GLOBALS["foo"] =& $var). Now that I think of this example I'd actually prefer to 
see $LEXICALS[] or something similar to access variables then go with the broken global/stat
ic behavior. This will bite us and people will complain... In general, I always recommend to
 people to keep away from "global" and go with "$GLOBALS[]".
- Minor implementation suggestion: I am not sure we need those flags for closures and have t
hose if() statements before function calls. We took the same approach with other obfuscated 
functions/methods/variables. If the developer *really* wants to cheat the engine and assembl
e an obfuscated name then he can. It's like doing the following in C: ((fun(*)()) 0x454544)(
). I say, be my guest. It just simplifies implementation a bit. No biggy but consistent with
 the rest of PHP.
- Please check eval(). I assume it will bind to global scope but let's just make sure what h
appens esp. when it's called from within a method...
- In PHP 5, object storage is resources done right. I don't think we should be using the res
ource infrastructure for this implementation and would prefer to use the object one. It's be
tter. I suggest to take a look at it.

Will also look into byte code cache implementation issues incl. performance pieces but it lo
oks like there shouldn't be any show stoppers here but I want to verify.

Thanks again for your hard work!

Andi
Thread:
Christian Seiler
Wez Furlong
Dmitry Stogov
Stanislav Malyshev
Alexander Wagner
Dmitry Stogov
Andi Gutmans
Christian Seiler
Lukas Kahwe Smith
Sebastian Bergmann
Marcus Boerger
Markus Fischer
Troels Knak-Nielsen
Christian Seiler
Dmitry Stogov
Larry Garfield
Christian Seiler
Dmitry Stogov
Christian Seiler
Lars Strojny
Stanislav Malyshev
Marcus Boerger
Lars Strojny
Troels Knak-Nielsen
Larry Garfield
Marcus Boerger
Dmitry Stogov
Andi Gutmans
Alexander Wagner
Andi Gutmans
Alexander Wagner
Alexander Wagner
Christian Seiler
Alexander Wagner
Lars Strojny
Dmitry Stogov
Marcus Boerger
Lars Strojny
Dmitry Stogov
Alexey Zakhlestin
Federico Lebron
Dmitry Stogov
Rodrigo Saboya
lenar
Larry Garfield
Stanislav Malyshev
Marcus Boerger
Alexander Wagner
Lars Strojny
Larry Garfield
Robert Cummings
Rodrigo Saboya
Alexander Wagner
Christian Seiler
Chris Stockton
Alexander Wagner
Troels Knak-Nielsen
Andi Gutmans
Marcus Boerger
Christian Seiler
Lukas Kahwe Smith
Gwynne Raskind
Andi Gutmans
Christian Seiler
Stanislav Malyshev
Kalle Sommer Nielsen
Troels Knak-Nielsen
Lars Strojny
Alexander Wagner
Stanislav Malyshev
Alexander Wagner
Andi Gutmans
Marcus Boerger
Kalle Sommer Nielsen
Troels Knak-Nielsen
Stanislav Malyshev
Alexey Zakhlestin
Chris Stockton
Alexey Zakhlestin
Gwynne Raskind
Stanislav Malyshev
Christian Seiler
Gwynne Raskind
Stanislav Malyshev
Richard Quadling
Christopher Jones
Marcus Boerger
Steph Fox
Christian Seiler
Marcus Boerger
Stanislav Malyshev
Lars Strojny
Christian Seiler
Stanislav Malyshev
Marcus Boerger
Marcus Boerger
Andrei Zmievski
Stanislav Malyshev
Stanislav Malyshev
Alexey Zakhlestin
Chris Stockton
Christian Seiler
Christian Seiler
Larry Garfield
Edward Z. Yang
Christian Seiler
Larry Garfield
Christian Seiler
Nathan Nobbe
Christian Seiler
Alexey Zakhlestin
Larry Garfield
Philip Olson

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved