Re: [PHP-DEV] Return type hinting patch

2008-04-26 Thread Sam Barrow
I like the first too, if this can be implemented I think it is a suitable syntax. On Sat, 2008-04-26 at 00:13 +0100, Alain Williams wrote: public function int doThing(string $foo) { return 1; } The above is the best (ie omit 'return' or 'returns'). This also is consistent with C and with

Re: [PHP-DEV] Return type hinting patch

2008-04-26 Thread David Zülke
Wouldn't the most consistent way be to omit function altogether when using a return type hint? public static function zomg() { return $somethingArbitrary; } public static string foo() { return $mustBeString; } otoh, should there ever be a type function (e.g. for anonymous funcs) down

[PHP-DEV] Help with calling PHP functions

2008-04-26 Thread Dhiru Pandey
[My apologies if I am posting on the wrong group...please point me to the right one] I am trying to figure out a way to invoke PHP functions directly i.e. bypassing the PHP compiler (scanner and parser). For now it would be great if I can get some help calling them from C. Ultimately I would

[PHP-DEV] Re: Help with calling PHP functions

2008-04-26 Thread Edward Z. Yang
Dhiru Pandey wrote: I am trying to figure out a way to invoke PHP functions directly i.e. bypassing the PHP compiler (scanner and parser). For now it would be great if I can get some help calling them from C. Ultimately I would like to call them from Java. It's not difficult to call

[PHP-DEV] Re: Help with calling PHP functions

2008-04-26 Thread Dhiru Pandey
Thanks for responding. May be I mis-wrote. What I would really like is a way to call the native c functions of the php implementation directly (bypassing the PHP compiler) like: PHP_FUNCTION(str_repeat) PHP_FUNCTION(addcslashes) etc. In other words I would like to invoke this functions

[PHP-DEV] Re: Help with calling PHP functions

2008-04-26 Thread Edward Z. Yang
Dhiru Pandey wrote: Thanks for responding. May be I mis-wrote. What I would really like is a way to call the native c functions of the php implementation directly (bypassing the PHP compiler) like: PHP_FUNCTION(str_repeat) PHP_FUNCTION(addcslashes) etc. In other words I would like to

[PHP-DEV] Re: Help with calling PHP functions

2008-04-26 Thread Edward Z. Yang
Edward Z. Yang wrote: Callback works with the native C functions too. It'll be pretty nasty trying to get all of PHP's macros to work from scratch. Just use the infrastructure that's in place already. Sorry about the double-post; I should clarify: I mean that callback works with PHP functions

Re: [PHP-DEV] Help with calling PHP functions

2008-04-26 Thread Nathan Nobbe
On Sat, Apr 26, 2008 at 2:23 PM, Dhiru Pandey [EMAIL PROTECTED] wrote: [My apologies if I am posting on the wrong group...please point me to the right one] I am trying to figure out a way to invoke PHP functions directly i.e. bypassing the PHP compiler (scanner and parser). For now it would

Re: [PHP-DEV] Return type hinting patch

2008-04-26 Thread Nathan Nobbe
On Sat, Apr 26, 2008 at 2:06 PM, David Zülke [EMAIL PROTECTED] wrote: Wouldn't the most consistent way be to omit function altogether when using a return type hint? public static function zomg() { return $somethingArbitrary; } public static string foo() { return $mustBeString; } i

Re: [PHP-DEV] Return type hinting patch

2008-04-26 Thread David Zülke
Am 27.04.2008 um 00:24 schrieb Nathan Nobbe: On Sat, Apr 26, 2008 at 2:06 PM, David Zülke [EMAIL PROTECTED] wrote: Wouldn't the most consistent way be to omit function altogether when using a return type hint? public static function zomg() { return $somethingArbitrary; } public static

Re: [PHP-DEV] Return type hinting patch

2008-04-26 Thread Chris Stockton
*cough* lambda *cough* On Sat, Apr 26, 2008 at 4:26 PM, David Zülke [EMAIL PROTECTED] wrote: Am 27.04.2008 um 00:24 schrieb Nathan Nobbe: On Sat, Apr 26, 2008 at 2:06 PM, David Zülke [EMAIL PROTECTED] wrote: Wouldn't the most consistent way be to omit function altogether when using a

Re: [PHP-DEV] Return type hinting patch

2008-04-26 Thread David Zülke
But anonymous functions and lambda expressions are not the same thing... David Am 27.04.2008 um 02:11 schrieb Chris Stockton: *cough* lambda *cough* On Sat, Apr 26, 2008 at 4:26 PM, David Zülke [EMAIL PROTECTED] wrote: Am 27.04.2008 um 00:24 schrieb Nathan Nobbe: On Sat, Apr 26, 2008

Re: [PHP-DEV] Return type hinting patch

2008-04-26 Thread Chris Stockton
Anonymous functions as you know them today come from lambda calculus which was created before computers were even made. Generally it is agreed anon func == labmda can be used interchangeably. Most developers will understand what: public function lambda sowat () { return function OR lambda,

[PHP-DEV] Const-correctness with Zend

2008-04-26 Thread Edward Z. Yang
I'm getting persistent const qualifier warnings with MSVC 2005 Express, along these lines: ..\extra\uriparser\uriparser.c(227) : warning C4090: 'function' : different 'const' qualifiers where line 227 looks like add_next_index_stringl(path_array, walker-text.first, walker-text.afterLast -