Req #51469 [Com]: why not Inner Classes?

2010-04-14 Thread giorgio dot liscio at email dot it
Edit report at http://bugs.php.net/bug.php?id=51469edit=1

 ID:   51469
 Comment by:   giorgio dot liscio at email dot it
 Reported by:  giorgio dot liscio at email dot it
 Summary:  why not Inner Classes?
 Status:   Open
 Type: Feature/Change Request
 Package:  Class/Object related
 Operating System: irrelevant
 PHP Version:  5.3.2

 New Comment:

they are not, actually


Previous Comments:

[2010-04-14 03:10:51] david71rj at gmail dot com

You can use namespaces from PHP 5.3, is basically this. See doc.


[2010-04-03 07:55:22] giorgio dot liscio at email dot it

Description:

hi, some object oriented architectures requires inner classes

i'm not good with english language so i write some examples:



in a library like PDO, now we can do some like this:



class Database

{

public function prepareSql($sql){ return new Sql($sql)}

}



class Sql

{

public function setValue($search, $replace){}

public function executeQuery(){return new ExecutedQuery();}

}



class ExecutedQuery

{

function fetch()

function numRows()

// etc

}



this api allows the developer to instantiate an ExecutedQuery with no
Sql parameters escaping (class Sql)



so inner classes are useful to make visible classes in some trusted
environment:



class Database

{

public function prepareSql($sql){ return new Sql($sql)}



class Sql

{

public function setValue($search, $replace){}

public function executeQuery(){return new ExecutedQuery();}

class ExecutedQuery

{

function fetch()

function numRows()

// etc

}

}

}



i've read a lot of rfc on php's wiki but no one talks about inner
classes (useful like traits and others new work in progress features)



what do you think about this?







-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51469edit=1


Req #51469 [Com]: why not Inner Classes?

2010-04-13 Thread david71rj at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=51469edit=1

 ID:   51469
 Comment by:   david71rj at gmail dot com
 Reported by:  giorgio dot liscio at email dot it
 Summary:  why not Inner Classes?
 Status:   Open
 Type: Feature/Change Request
 Package:  Class/Object related
 Operating System: irrelevant
 PHP Version:  5.3.2

 New Comment:

You can use namespaces from PHP 5.3, is basically this. See doc.


Previous Comments:

[2010-04-03 07:55:22] giorgio dot liscio at email dot it

Description:

hi, some object oriented architectures requires inner classes

i'm not good with english language so i write some examples:



in a library like PDO, now we can do some like this:



class Database

{

public function prepareSql($sql){ return new Sql($sql)}

}



class Sql

{

public function setValue($search, $replace){}

public function executeQuery(){return new ExecutedQuery();}

}



class ExecutedQuery

{

function fetch()

function numRows()

// etc

}



this api allows the developer to instantiate an ExecutedQuery with no
Sql parameters escaping (class Sql)



so inner classes are useful to make visible classes in some trusted
environment:



class Database

{

public function prepareSql($sql){ return new Sql($sql)}



class Sql

{

public function setValue($search, $replace){}

public function executeQuery(){return new ExecutedQuery();}

class ExecutedQuery

{

function fetch()

function numRows()

// etc

}

}

}



i've read a lot of rfc on php's wiki but no one talks about inner
classes (useful like traits and others new work in progress features)



what do you think about this?







-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51469edit=1