By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

A PHP fork

P: n/a
For the past few months I've been working on a fork of PHP from the
version 4 source code. I call the new dialect "Polar." It's different
from PHP 5 in that it's a procedural-centric language. One of the key
additions is function overloading, which lets you do polymorphism
procedurally:

function db_query($sql, $db:MySQLDB) {
/* MySQL-specific code here */
}

function db_query($sql, $db:PostgresDB) {
/* Postgres-specific code here */
}

Aside from that there are many other enhancements like a float-based
datetime type and a Unicode string type. It's pretty neat. You can find
more information at http://www.polarwiki.net/. The site is hosted on
the Polar itself, though it's running mostly PHP apps. I have built a
standalone Windows program that demonstrate the new features. You can
download it at the the web site.

Right now I'm just an army of one. I'm definitely looking for more
help. Drop a note in the message forum if you interested. Any comments
are welcomed too.

Jul 6 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Function overloading is a feature a lot of people want. Why not merge
this with the existing PHP code? I'm sure they would love to have
someone with your talent contributing!
Chung Leong wrote:
For the past few months I've been working on a fork of PHP from the
version 4 source code. I call the new dialect "Polar." It's different
from PHP 5 in that it's a procedural-centric language. One of the key
additions is function overloading, which lets you do polymorphism
procedurally:

function db_query($sql, $db:MySQLDB) {
/* MySQL-specific code here */
}

function db_query($sql, $db:PostgresDB) {
/* Postgres-specific code here */
}

Aside from that there are many other enhancements like a float-based
datetime type and a Unicode string type. It's pretty neat. You can find
more information at http://www.polarwiki.net/. The site is hosted on
the Polar itself, though it's running mostly PHP apps. I have built a
standalone Windows program that demonstrate the new features. You can
download it at the the web site.

Right now I'm just an army of one. I'm definitely looking for more
help. Drop a note in the message forum if you interested. Any comments
are welcomed too.
Jul 7 '06 #2

P: n/a
Wow! Nice work man!

I'm a big fan of OO myself, but as already mentioned there are a lot of
people out there wanting more from PHP in the procedural programming
department.

Good on you for taking the initiative to do this.

t

Chung Leong wrote:
For the past few months I've been working on a fork of PHP from the
version 4 source code. I call the new dialect "Polar." It's different
from PHP 5 in that it's a procedural-centric language. One of the key
additions is function overloading, which lets you do polymorphism
procedurally:

function db_query($sql, $db:MySQLDB) {
/* MySQL-specific code here */
}

function db_query($sql, $db:PostgresDB) {
/* Postgres-specific code here */
}

Aside from that there are many other enhancements like a float-based
datetime type and a Unicode string type. It's pretty neat. You can find
more information at http://www.polarwiki.net/. The site is hosted on
the Polar itself, though it's running mostly PHP apps. I have built a
standalone Windows program that demonstrate the new features. You can
download it at the the web site.

Right now I'm just an army of one. I'm definitely looking for more
help. Drop a note in the message forum if you interested. Any comments
are welcomed too.
Jul 7 '06 #3

P: n/a
Richard Levasseur wrote:
Function overloading is a feature a lot of people want. Why not merge
this with the existing PHP code? I'm sure they would love to have
someone with your talent contributing!
Function overloading in Polar only works for standalone functions, not
class methods. As the intention here is to move away from OOP, that's
fine. I doubt that that's a limitation people would accept, since OOP
is the direction that PHP is heading.

Overloading in a dynamically typed language is rather different from
overloading in a strongly typed language like C++. In the latter,
resolution of function calls happens at compile time. In the former, it
has to happn at runtime. Overloading here is a form of dynamic
dispatch, akin to calling virtual methods on an object. Having two
dynamic dispatch mechanisms working in unison is probably too
confusing.

Jul 7 '06 #4

P: n/a
Chung Leong wrote:
For the past few months I've been working on a fork of PHP from the
version 4 source code. I call the new dialect "Polar."
<snip>

Kudos. When everyone is digging on frameworks and Ajax, you did
fork PHP! I suppose, you have enough free time;-) Changes look cool
<http://www.polarwiki.net/index.pola/Changes_in_Polar All the best.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 7 '06 #5

P: n/a
On Thu, 06 Jul 2006 13:48:23 -0700, Chung Leong wrote:
For the past few months I've been working on a fork of PHP from the
version 4 source code. I call the new dialect "Polar." It's different
from PHP 5 in that it's a procedural-centric language. One of the key
additions is function overloading, which lets you do polymorphism
procedurally:

function db_query($sql, $db:MySQLDB) {
/* MySQL-specific code here */
}

function db_query($sql, $db:PostgresDB) {
/* Postgres-specific code here */
}

Aside from that there are many other enhancements like a float-based
datetime type and a Unicode string type. It's pretty neat. You can find
more information at http://www.polarwiki.net/. The site is hosted on
the Polar itself, though it's running mostly PHP apps. I have built a
standalone Windows program that demonstrate the new features. You can
download it at the the web site.

Right now I'm just an army of one. I'm definitely looking for more
help. Drop a note in the message forum if you interested. Any comments
are welcomed too.
Chung, you're one of my favorite PHP masters and I learned few things from
you on this group, but the work you're doing has already been done. PHP
runkit extension, by Sara Golemon, has this possibility:

RUNKIT_IMPORT_OVERRIDE (integer)

runkit_import() flag indicating that if any of the imported functions,
methods, constants, or properties already exist, they should be
replaced with the new definitions. If this flag is not set, then any
imported definitions which already exist will be discarded.

This sounds very much like overloading to me.
--
http://www.mgogala.com

Jul 7 '06 #6

P: n/a
On Fri, 07 Jul 2006 18:49:07 GMT, Mladen Gogala <go****@sbcglobal.netwrote:
>Chung, you're one of my favorite PHP masters and I learned few things from
you on this group, but the work you're doing has already been done. PHP
runkit extension, by Sara Golemon, has this possibility:

RUNKIT_IMPORT_OVERRIDE (integer)

runkit_import() flag indicating that if any of the imported functions,
methods, constants, or properties already exist, they should be
replaced with the new definitions. If this flag is not set, then any
imported definitions which already exist will be discarded.

This sounds very much like overloading to me.
That's just redefinition, not overloading...

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jul 7 '06 #7

P: n/a
Mladen Gogala wrote:
Chung, you're one of my favorite PHP masters and I learned few things from
you on this group, but the work you're doing has already been done. PHP
runkit extension, by Sara Golemon, has this possibility:

RUNKIT_IMPORT_OVERRIDE (integer)

runkit_import() flag indicating that if any of the imported functions,
methods, constants, or properties already exist, they should be
replaced with the new definitions. If this flag is not set, then any
imported definitions which already exist will be discarded.

This sounds very much like overloading to me.
No, actually it's not even close. The runkit just exposes
functionalities in the Zend engine. Overwriting a function is not the
same as overloading it. Wikipedia has a good explanation
http://en.wikipedia.org/wiki/Function_overloading.

What Polar supports is a type of dynamic dispatch, controlled by the
types of the arguments. I call it Sematic Polymorphism. It's similiar
to polymorphism in OOP, except functions are bound to meanings not
objects.

Say we have the following functions:

<?

function SaveObjectToDatabase($object:Object, $db:MysqlDB) {
}

function SaveObjectToDatabase($article:Article, $db:MysqlDB) {
}

?>

Both functions are bound to the meaning of "saving an object to a MySQL
database." The second function is bound to a more specific meaning,
that of "saving an object of the class Article to a MySQL database." In
OOP terms we would say that the second meaning is a descendant of the
first. The relationship isn't stated explicitly, but it's understood.

It's neat idea. There're also a host of other features which I think
are pretty interesting. Pragmas for example. Or Flex case identifiers.
If you have time, take a look at the demo program. You can download it
here:
http://sourceforge.net/project/showf...roup_id=171247

Jul 7 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.