for the sake of conversation - syntax
| From: | Nathan Rixham | Date: | Mon, 29 Sep 2008 11:47:38 +0000 |
| Subject: | for the sake of conversation - syntax | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-281088@lists.php.net to get a copy of this message | ||
Afternoon All,
Last week I got to thinking about PHP vs other languages.. sparing the details this is what I decided I'd like my code to look like :) [what *I* /as an OO developer/ need(?want)]
<?php
package com.mydom.thispackage
{
import com.anotherdom.MysqlDbHandler as DbHandlerA;
import com.somedom.DbHandler as DbHandlerB; # "as" makes this easier
import com.mydom.thatpackage.RssParser; # we don't have to "as"
import net.php.pecl.Tidy into TidySpace; # "into namespace"
import org.nicedom.alwaysusethese.*; # why not?
public class MyClass # visibility on classes
{
private $dba:DbHandlerA = new DbHandlerA();
private $dbb:DbHandlerB = new DbHandlerB();
protected $xmlString:String;
public function __construct( String $xml ):void #return types
{
if( TidySpace::tidy_is_xml( $xml ) ) { #namespace function call
$this->xmlString = TidySpace::tidy_repair_string( $xml );
}
}
}
}
?>
all purely a made up example; I'd be interested to here any comments or what your ideal language (/modified php) would look like.
Regards!