Hi all!

I know, it's too late to propose such things before PHP5.0.0, but maybe there is a 
chance to include it to 5.1...

Short example:
<?

class Some {
   const singleton = true;
}

$class_name = "Some";

/*  I'd like to have such syntax */
if ($class_name::singleton) { //doesn't work ATM
 /* blah-blah */
}

if (eval("$class_name::singleton") { //DOES work ATM, but is really ugly
 /* blah-blah */
}

$class_name = "Some";
$const_name = "singleton";

/* AND/OR even such syntax */

if ($class_name::$const_name) { //doesn't work ATM
 /* blah-blah */
}

?>

I found similar ideas here: 
http://lists.php.net/article.php?group=php.internals&article=7980, 
but this patch doesn't allow to fetch constants from the class.
I've tried to write a patch for language parser, but I found this bison/yacc stuff too 
tricky for me =(

IMHO this addon will not affect other stuff (at least I can't see any possible 
problems it could cause), but could be very useful.
Is it possible to implement such syntax in 5.x ?

---
WBR,
Antony Dovgal aka tony2001
[EMAIL PROTECTED] || [EMAIL PROTECTED]

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to