New notation for easy use/reading
| From: | JUNG, SungYoung | Date: | Tue, 21 Sep 1999 11:22:48 +0000 |
| Subject: | New notation for easy use/reading | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11142@lists.php.net to get a copy of this message | ||
There are some annoying syntax in php. For example, The class referencer
"->" and self class pointer "this->" make programmer annoying, and detract
readability. For example containing member in class type.
...
class CText
{
var $buffer;
...
}
class CTest
{
var $content;
function a()
{
$content = new CText;
echo $this->content->member ;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : not good for read/write
}
}
...
It is more sever when class type is used many times.
How about change class referencer "->" char to "." for short notation, and
string concatenator "." to ":" or "+" ? It is cumbersome in writing.
And I
think "this" self class poiner also not necessary
-----------------------------------------------------
operator php ==> php+
-----------------------------------------------------
class referencer -> .
string concatenator . : (or +)
self class pointer this (can be omitted)
------------------------------------------------------
An example code in php,
class a{
var $m;
function a( $b,$c)
{
$this->m = $b.c.$this->m;
return $this->m;
}
}
than, Now new php version will have more clean code like
class a{
var $m;
a( $b,$c)
{
$m = $b:$c:$m;
return $m;
}
}
If you cannot remove "this" pointer for speed consideration of real time
parser. There is another possibility. Just regard class reference "." ( "->"
in php) as "this" pointer reference by default.
then the source code will look like
than, Now php+ will have more clean code like
class a{
var $m;
a( $b,$c)
{
$.m = $b:$c:$.m; // omitted "this" pointer
return $.m;
}
}