Hi all.
(Again, I've searched the archives, but haven't found anything on this one)
The ArrayAccess interface allows one to essentially overload the index
operator [] [1], which is nice, as it makes it possible to implement
things like type-checked associative arrays, variants, tuples, etc.
Hello Terje,
long ago we decided against supporting it in the array functions.
best regards
marcus
Wednesday, September 13, 2006, 8:39:57 AM, you wrote:
Hi all.
(Again, I've searched the archives, but haven't found anything on this one)
The ArrayAccess interface allows one to essentially
(This may be considered too radical for some, but I ask, anyway... Also, if
there's a more appropropriate place to ask such questions, let me know, but
as this is the developer's list, it seemed like the right place)
In C++, it's possible to declare member functions const meaning they don't
On 12/09/06, Terje Slettebø [EMAIL PROTECTED] wrote:
function f(Something $value) /** @return SomethingElse */
{
// ...
}
One of the good things about PHP is the loose typing (1.00 == 1 == 1
sort of thing as I understand it). This has been useful.
But one of the first things we are told
Hi,
i just was wondering how existing function names could be used as method names
in OO-Extensions for PHP5. I've looked through the SPL-source where this is
done with
functions like current() and next() in the iterators, but I couldn't find a
hint how to do this.
Can someone give me a little
On Wed, Sep 13, 2006 at 10:09:08AM +0200, [EMAIL PROTECTED] wrote:
Hi,
i just was wondering how existing function names could be used as method names
in OO-Extensions for PHP5. I've looked through the SPL-source where this is
done with
functions like current() and next() in the iterators,
...Just forgot to CC...
you can use any function name as method name without a clash. you just
cannot use language constructs that aren't real functions like
empty, echo or require as method names.
this question better belongs to php-general, btw.
Sorry if I didn't made myself clear enough. I'm
From: Richard Quadling [EMAIL PROTECTED]
On 12/09/06, Terje Slettebø [EMAIL PROTECTED] wrote:
function f(Something $value) /** @return SomethingElse */
{
// ...
}
One of the good things about PHP is the loose typing (1.00 == 1 == 1
sort of thing as I understand it). This has been
On 13/09/06, Terje Slettebø [EMAIL PROTECTED] wrote:
From: Richard Quadling [EMAIL PROTECTED]
On 12/09/06, Terje Slettebø [EMAIL PROTECTED] wrote:
function f(Something $value) /** @return SomethingElse */
{
// ...
}
But one of the first things we are told about using PHP ITRW is
Either way is fine with me, as long as I get the class name in the warning
-Hannes
On 9/11/06, Marcus Boerger [EMAIL PROTECTED] wrote:
Hello Andrei,
for some reason i like instance of class better than class object.
The reason is that we have instances rather than objects - So it's a
purist
Richard Quadling [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
On 13/09/06, Terje Slettebø [EMAIL PROTECTED] wrote:
..
The issue then becomes what would happen to a value of the wrong type?
You either have the option of using PHP's own internal casting
mechanism, so
On Wed, 13 Sep 2006 11:35:16 +0200
[EMAIL PROTECTED] wrote:
...Just forgot to CC...
you can use any function name as method name without a clash. you
just cannot use language constructs that aren't real functions like
empty, echo or require as method names.
this question better belongs to
Hi Marcus.
long ago we decided against supporting it in the array functions.
Ok, thanks. Could I ask what the reasons were (Alternatively get a pointer
to the discussion)?
Regards,
Terje
best regards
marcus
Wednesday, September 13, 2006, 8:39:57 AM, you wrote:
Hi all.
(Again,
It is possible to name a method like an existing function, I'm not sure
what you are doing exactly but it works here.
I've tried: STRING_METHOD(String, trim) {...} (Yes, I'm trying to build a
string class)
that means that I also redefinied the Macros. Then I've changed the Macros from
Terje Slettebø wrote:
I'd say that's debatable. :) Yes, it can make it more convenient to handle
data coming from outside the script (such as forms), but it can also hide
bugs. While it can be argued that conversions between, say, arithmetic types
(int and floats) may be useful, allowing
Hello,
On 9/13/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
It is possible to name a method like an existing function, I'm not sure
what you are doing exactly but it works here.
I've tried: STRING_METHOD(String, trim) {...} (Yes, I'm trying to build a
string class)
that means that I also
On 9/13/06, Pierre [EMAIL PROTECTED] wrote:
No, as I said it works well before 5.2 except for zip_* function name
and a uip class.
I mean for zip_* function names and a zip class :)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Can you show some code? It will help to figure out
what's wrong.
Yes I can :)
stringclass.h
#ifndef PHP_STRINGCLASS_H
#define PHP_STRINGCLASS_H
extern zend_module_entry string_module_entry;
#define phpext_string_ptr string_module_entry
#ifdef PHP_WIN32
#define PHP_STRING_API
zend_module_entry string_module_entry = {
#if ZEND_MODULE_API_NO = 20010901
STANDARD_MODULE_HEADER,
#endif
string,
string_functions,
PHP_MINIT(string),
PHP_MSHUTDOWN(string),
PHP_RINIT(string), /* Replace with NULL if there's nothing to do at
request start */
Show me how many times we use instance versus object in PHP.
-Andrei
On Sep 11, 2006, at 5:31 PM, Marcus Boerger wrote:
Hello Andrei,
for some reason i like instance of class better than class
object.
The reason is that we have instances rather than objects - So it's a
purist thing.
Solution: Change string_functions to NULL in zend_module_entry.
Thanks! You rescued my extension. Now I can finish and test the class.
#define STRING_METHOD(function_name) \
ZEND_NAMED_FUNCTION(c_stringclass_##function_name)
#define STRING_ME(name, arg_info, flags) \
In C++, it's possible to declare member functions const meaning they don't
change the object they operate on. This can help reason about programs,
because if you have something like (PHP syntax):
It would be pretty hard to enforce in PHP - how do you know the object
is not changed, without
Terje Slettebø wrote:
I'd say that's debatable. :) Yes, it can make it more convenient to
handle
data coming from outside the script (such as forms), but it can also
hide
bugs. While it can be argued that conversions between, say, arithmetic
types
(int and floats) may be useful, allowing
In C++, it's possible to declare member functions const meaning they
don't
change the object they operate on. This can help reason about programs,
because if you have something like (PHP syntax):
It would be pretty hard to enforce in PHP - how do you know the object
is not changed,
--- Start ---
class Something
{
public function __construct()
{
// Oops, forgot to initialise $this-something...
}
public function f()
{
return $this-something;
}
private $something;
}
error_reporting(E_ALL);
$something=new Something;
echo $something-f()+10; // Prints
Hello Terje,
sorry i often only remember the outcome.
best regards
marcus
Wednesday, September 13, 2006, 9:52:57 AM, you wrote:
Hi Marcus.
long ago we decided against supporting it in the array functions.
Ok, thanks. Could I ask what the reasons were (Alternatively get a pointer
to
Hi François.
I think this sounds like a great idea. :) We do something similar with our
class loader, in that it scans a lib-directory and its subfolders, building
a map of class name to filename (it doesn't open the files - it only builds
the map based on file naming convention, allowing it to
From: Brian Moon [EMAIL PROTECTED]
--- Start ---
class Something
{
public function __construct()
{
// Oops, forgot to initialise $this-something...
}
public function f()
{
return $this-something;
}
private $something;
}
28 matches
Mail list logo