>primitive/common names is discouraged for non-core extensions
>-Sara
So what could be a proper naming convention for such classes?
My Idea is:
-PHPString
-PHPInteger/PHPInt
-...
Any suggestion is welcome.
Daniel
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:
>From: "Brian Moon" <[EMAIL PROTECTED]>
> > --- Start ---
> >
> > class Something
> > {
> > public function __construct()
> > {
> > // Oops, forgot to initialise $this->something...
> > }
> >
> > public function f()
> > {
> > return $this->something;
> > }
> >
> > private $so
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 in
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
>
--- 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; // Prin
> > 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 chang
> 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, a
>From: "Richard Quadling" <[EMAIL PROTECTED]>
> 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 */
> > > > {
> >
> As I wrote, I've looked around existing extensions which redefine function
> names
> (SPL and zip) and there I found those Macro-Definitions and thought this
> could be
> the solution.
>
Fair enoughI must not have read that in my review of the thread...
>>> #define string_G(v) (string_glob
Hi Andrei & Marcus
At first glance it looks like the only place we use "instance of
" is with type hinting:
Argument # passed to must be an instance of ,
instance of given
But the rest is "object of class ":
Cannot use object of type as array
Trying to clone an uncloneable object of class
Ex
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 st
>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) \
>> ZE
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 th
> 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 */
>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 __declspec(dll
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
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
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 conversi
>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
PHP_METH
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.
>
> > (
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 bet
""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
> mecha
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
p
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
>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
...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 eno
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 iterat
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 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 tol
(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
chan
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 essential
31 matches
Mail list logo