Hello Gwynne,
Monday, March 19, 2007, 3:13:28 AM, you wrote:
On Mar 18, 2007, at 9:30 PM, Wez Furlong wrote:
Your nitpicking happens to be wrong ;-)
sizeof(string constant) is the same as strlen(string constant)
+1, but is resolved at compile time, so we use sizeof(string
constant)-1 to
Hello Wez,
interesting solution. Nice work:-)
Monday, March 19, 2007, 1:48:31 AM, you wrote:
Updated patch at http://pastebin.ca/400952
Not 100% sure if my hack in zend_compile.c is righteous, but it
doesn't seem too far wrong.
--Wez.
Best regards,
Marcus
--
PHP Internals - PHP
On 03/18/2007 12:32 PM, Tijnema ! wrote:
On 3/18/07, Mike Robinson [EMAIL PROTECTED] wrote:
Tijnema !
Well, i installed sendmail 8.14.0, and it did install the
sendmail binary into /usr/sbin/sendmail, and configure could
find it, so i recompiled/reinstalled PHP and now it still
can't find
On 03/19/2007 02:24 AM, Doug Goldstein wrote:
Hi,
I'm going to be taking over maintaining ext/ldap as per my discussions
with Antony Dovgal and Ilia Alshanetsky. So I need to get setup with a
CVS account to be able to commit.
Confirmed.
--
Wbr,
Antony Dovgal
--
PHP Internals - PHP Runtime
On 03/19/2007 02:41 AM, Wez Furlong wrote:
We've been daydreaming about the ability to do something like this in
PHP:
I don't have any objections, the only requirement from me is that it should be
covered by tests as much as possible.
So I would like to encourage people to write tests to
Wez Furlong wrote:
So, the question is, do we want this in PHP?
Yes, please. (It might even make my userland implementation of of CLOS-
style generic functions easier.)
--
Sebastian Bergmann http://sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD
PHP 6 Bug Database summary - http://bugs.php.net
Num Status Summary (40 total including feature requests)
===[*General Issues]==
26771 Suspended register_tick_funtions crash under threaded webservers
27372 Verified parse error
Hey, thanks, I was researching this exact same thing. You make it appear much
easier than it is. You've just saved me many months, weeks, and hours trying to
figure out how to mess with the internals of the Zend Engine. For that, I am
most grateful.
Also, I would love to see this in PHP, at
Lukas Kahwe Smith wrote:
IMHO a full ORM belongs into user space and not into C code. I kind of
like the approach that ADODB did, which was taking an existing DBAL and
moving selected items that where bottlenecks into C space. Thereby
providing a drop in speed improvement, while keeping the
Tony Bibbs wrote:
I agree. I'm a user of Propel (http://propel.phpdb.org) which is in the
user space as you suggest and I think it works fine. The current beta
version of Propel uses PDO so execution speed isn't really a huge
FYI: You are mistaken if you think that moving from the old
Lukas Kahwe Smith wrote:
FYI: You are mistaken if you think that moving from the old extensions
to PDO provides a speed improvement (there is rather decrease unless you
are using fetchAll()).
Sorry, I wasn't clear on this. Creole is the DB abstraction layer on top
of the old extensions.
On Sun, Mar 18, 2007 at 08:48:31PM -0400, Wez Furlong wrote:
Updated patch at http://pastebin.ca/400952
This is interesting. I'm not sure I'll ever use it (I prefer named
functions), but it's a purely optional and folks seem to want
something like this.
One comment on the patch itself:
Hello,
I am working on a command line client (written in php, run by
php-cli) and I'd like to use a password entry as in mysql client - with
no echoing etc. I've found the function which I need:
#include unistd.h
char *getpass( const char * prompt );
But in man getpass it is
Also, I would love to see this in PHP, at the very least it would negate
the argument of those who say PHP doesn't support anonymous functions.
This argument is false in any case, since create_function exists and
this implementation is other way to write create_function :)
--
Stanislav
Pure C code has access to PHP5's low level object API, so it can produce
a really intuitive interface (object persistence), that you can't do
from PHP code. C code uses a bit less memory and a lot less CPU time
Just curious - which access do you need that PHP API doesn't give?
And one more
I am taking over the maintainership for ext/ldap as per my discussions with
Antony Dovgal and Ilia Alshanetsky.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Well, making it work makes this thing closure. Otherwise it's just a
nice way to save a couple of keystrokes :) Not to diminish your work,
but there's a danger people would think it is closure because it looks
like one (i.e., in other languages closures look exactly this way, e.g.
If the answer is New, then this could be compiled at.. well,
compile-time, not at execute time. That could be even more interesting.
If it would create anonymous function compile-time, it would be a big
advantage to Wez's patch because then this function could be cached.
Thinking about this,
First, here's what I've done so far in the subject:
http://dbobj.sourceforge.net/bzr/dbobj/
And here's a quite dreary wiki feel free to update it...
http://dbobj.sourceforge.net/wiki/HomePage
However, there are some notes on these:
1, I didn't spend much time on documentation writing, because
If it would create anonymous function compile-time, it would be a big
advantage to Wez's patch because then this function could be cached.
Thinking about this, maybe it is the reason enough to do this even if
it's not real closure.
On mulling this over a bit more, other than quick one-off
I've been thinking about this on and off today too.
Something along the lines of the following is more in the PHP spirit:
$ver = phpversion();
$fancyVer = function () { lexical $ver; return PHP $ver; };
Where lexical is a keyword that means inherit this variable from
the current lexical
Hi,
This is an interesting project!
I am currently implementing an ORM tool based on this white paper from
Mr. Scott W. Ambler (from IBM):
http://www.ambysoft.com/essays/persistenceLayer.html
I think that a compiled C ORM tool doesn't have too much advantage
over a PHP code based. The
If we can solve the scoping problem (perhaps via references as you
mentioned), then lexical (or another keyword, to be debated endlessly
for months, whose name-debate will delay the implementation of this
functionality, but I digress...) seems like a good solution to grabbing
scope, and fits the
I've been thinking about this on and off today too.
Something along the lines of the following is more in the PHP spirit:
$ver = phpversion();
$fancyVer = function () { lexical $ver; return PHP $ver; };
Where lexical is a keyword that means inherit this variable from the
current lexical scope.
On Sun, March 18, 2007 6:41 pm, Wez Furlong wrote:
We've been daydreaming about the ability to do something like this in
PHP:
$data = array(zoo, orange, car, lemon, apple);
usort($data, function($a, $b) { return strcmp($a, $b); });
var_dump($data); # data is sorted alphabetically
I'd LOVE
On Sun, March 18, 2007 7:30 pm, Wez Furlong wrote:
I found another flaw; when used in a loop it keeps trying to declare
the same function over and over. I think this is because the
ZEND_DECLARE_FUNCTION opcode is emitted as part of the arg list
building op sequence.
I'm poking to find an
On Mon, 2007-03-19 at 13:15 -0700, Stanislav Malyshev wrote:
I've been thinking about this on and off today too.
Something along the lines of the following is more in the PHP spirit:
$ver = phpversion();
$fancyVer = function () { lexical $ver; return PHP $ver; };
Where lexical is a
On Mon, 2007-03-19 at 15:20 -0500, Richard Lynch wrote:
On Sun, March 18, 2007 6:41 pm, Wez Furlong wrote:
We've been daydreaming about the ability to do something like this in
PHP:
$data = array(zoo, orange, car, lemon, apple);
usort($data, function($a, $b) { return strcmp($a, $b); });
On Mar 19, 2007, at 4:15 PM, Stanislav Malyshev wrote:
How this is going to work? Variables are not interpreted by the
compiler now...
Well, the compiler would make a list of variables names to import and
store those in the zend_function structure. Then at the time the
function is
On Mon, March 19, 2007 3:35 pm, Robert Cummings wrote:
On Mon, 2007-03-19 at 15:20 -0500, Richard Lynch wrote:
On Sun, March 18, 2007 6:41 pm, Wez Furlong wrote:
We've been daydreaming about the ability to do something like this
in
PHP:
$data = array(zoo, orange, car, lemon, apple);
What about just having a function that allows retrieving variables from
the parent scope?
mixed seek_var( $name [, $levels=1, [ $startLevel=0 ] ] )
How you are going to know where parent scope is? It can even be not
existing anymore, or can be separated by any number of parameter
Well, the compiler would make a list of variables names to import and
store those in the zend_function structure. Then at the time the
function is bound (in response to a DECLARE_FUNCTION opcode), the
variable reference could be fixed up in the same way that global is
handled.
Global is not
On Mon, 2007-03-19 at 13:59 -0700, Stanislav Malyshev wrote:
What about just having a function that allows retrieving variables from
the parent scope?
mixed seek_var( $name [, $levels=1, [ $startLevel=0 ] ] )
How you are going to know where parent scope is? It can even be not
I guess I was primarily thinking in the context of the anonymous
function being defined in your previous example. As such the parent
scope is known (or at least can be expected), unless (unknown to me)
It is known in compile-time. But functions are not called in
compile-time. And in run-time,
I think the anonymous name having metadata about the __FILE__ __LINE__
__COLUMN__ would be pretty nifty for error messages and debuggers...
I'm a bit tired of seeing Error: blah blah in Unknown on line: 0
personally. :-)
This presumes somebody would take the effort to de-construct that
metadata
My implementation preserves this information.
--Wez.
On Mar 19, 2007, at 5:26 PM, Richard Lynch wrote:
I think the anonymous name having metadata about the __FILE__ __LINE__
__COLUMN__ would be pretty nifty for error messages and debuggers...
I'm a bit tired of seeing Error: blah blah in
On Mon, March 19, 2007 2:33 pm, Wez Furlong wrote:
I've been thinking about this on and off today too.
Something along the lines of the following is more in the PHP spirit:
$ver = phpversion();
$fancyVer = function () { lexical $ver; return PHP $ver; };
Where lexical is a keyword that means
regardless. As in my proposal, the seek could search all the way up to
the top in which case the $rev would be found if it had been defined as
The top of *what*? Anonymous function could be called from global scope too.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]
On Mon, March 19, 2007 1:59 pm, Bankó Ádám wrote:
2. In C I can implement all the structure I want (as long it's sane)
without much worrying about what performance cost it will have. I
wouldn't do the same in PHP. I'm talking about separate classes for
every database column type and abstract
I'm not arguing the preservation of the exact value of $rev when the
anonymous function was created (as would be the case with a closure).
I'm thinking of the variable being whatever is defined in the parent
regardless. As in my proposal, the seek could search all the way up to
the top in
We could compile the anonymous function at compile-time but leave
placeholders which need to be fixed-up when at run-time the actual
closure is created. For this purpose we could introduce a new magical
variables $_SCOPE[var] which references the current $var during fixup
time.
So here's an
So what this does is compile the anonymous function at compile-time,
but when this line is executed (note, this line of code should also be
reached during execution), then we do the fix-up for $_SCOPE variables.
Yes, this is basically what Wez was proposing I guess. This would
require new
Stanislav Malyshev wrote:
Thoughts?
This might work, still not sure if we really want that in PHP. On one
side, it's cool, on other side closures can develop into a very messy
code :)
Yeah well .. for the single task of callbacks they are great and prevent
a lot of messiness .. I think
2007. 03. 19, hétfő keltezéssel 16.51-kor Richard Lynch ezt írta:
I don't think you'd want the RAM/performance hit of that, even in C...
[shrug]
OTOH, I don't think I'd even want to use an ORM, so feel free to
ignore me completely. :-)
Hi!
I think a code is more manageable if it's more
On 3/16/07, Oliver Block [EMAIL PROTECTED] wrote:
Hello,
I receive a segmentation fault on a
RETVAL_STRING(some_module_global, 1);
The problem disappears if I change it to
RETVAL_STRING(some_module_global, 0);
Is anybody interested in the data?
Regards,
Oliver
As I understand
Why would this pollute less? It would still pollute the namespace.
-Original Message-
From: Lukas Kahwe Smith [mailto:[EMAIL PROTECTED]
Sent: Monday, March 19, 2007 3:08 PM
To: Stas Malyshev
Cc: Andi Gutmans; Robert Cummings; Wez Furlong; Sean Coates;
internals@lists.php.net
On Mon, March 19, 2007 4:55 pm, Stanislav Malyshev wrote:
You have to have a pretty esoteric function to need that kind of
scope
control, no?
Depends on your background. Some people consider LISP intuitive
language
:) And if you work with Javascript, you probably would be doing it
daily
-
Can't you just take the body of create_function with the syntax of
the patch, and marry those two?
Well, that'd be a bit hard since the whole difference is that
create_function is runtime (thus having access to run-time values) while
anon-func we are trying to do here is compile-time (at
Can't you just take the body of create_function with the syntax of
the patch, and marry those two?
I already explained why this can't work, in this very thread. At least
not without hacking { and } to work (mostly) like in this context.
How does the current create_function handle this same
On Mon, March 19, 2007 5:33 pm, Stanislav Malyshev wrote:
Can't you just take the body of create_function with the syntax of
the patch, and marry those two?
Well, that'd be a bit hard since the whole difference is that
create_function is runtime (thus having access to run-time values)
while
On Mon, 2007-03-19 at 17:53 -0400, Sean Coates wrote:
I'm not arguing the preservation of the exact value of $rev when the
anonymous function was created (as would be the case with a closure).
I'm thinking of the variable being whatever is defined in the parent
regardless. As in my
Richard Lynch wrote:
I'd be perfectly happy if PHP's anonymous functions had the nice
syntax and no funky weird stuff about closure, a la
eval/create_function, personally.
While the discussion about closures and how to emulate them was
interesting I think Richard hits the nail on the head.
Hello,
I rewrote imap_mail_compose() and (almost) everything works fine, but I can't
get rid of some memory leaks.
In order to compose nested mutlipart messages I created a hash_table
[Mon Mar 19 23:44:36 2007] Script: '/root/compose_multipart.php'
Oliver Block wrote:
Hello,
I rewrote imap_mail_compose() and (almost) everything works fine, but I can't
get rid of some memory leaks.
In order to compose nested mutlipart messages I created a hash_table
[Mon Mar 19 23:44:36 2007] Script: '/root/compose_multipart.php'
I've been thinking about this in the car, and it won't quite work as-is.
Here's a contrived example:
$funcs = array();
for ($i = 0; $i 10; $i++) {
$funcs[] = function() { return $_SCOPE['i']; };
}
Here I'm assuming that $_SCOPE takes a copy of $i during fixup.
The problem here is that the
--- Sean Coates [EMAIL PROTECTED] wrote:
I'm not arguing the preservation of the exact value of $rev when the
anonymous function was created (as would be the case with a closure).
I'm thinking of the variable being whatever is defined in the parent
regardless. As in my proposal, the seek
Hi Wez,
There are various ways to go about implementing this. While reading your
email I've had another couple of ideas incl. some funky parameter
passing games. All these ideas are legit and have pros/cons but what's
most important is actually from a feature point of view, whether we want
to do
57 matches
Mail list logo