Re: Const member functions

From: Date: Wed, 13 Sep 2006 18:04:45 +0000
Subject: Re: Const member functions
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-25669@lists.php.net to get a copy of this message
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 strictly typing all the functions that access it? Also, while in C++ compiler can benefit from knowing the function is const - i.e. from knowing nothing was changed by it regarding this argument - PHP engine hardly can do it.

« previous php.internals (#25669) next »