473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

A PHP fork

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
7 4807
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Benoit Dejean | last post by:
hello, i have a question about forking processes atm, i have some code which i want to rewrite os.system("cd ~ && exec " + cmd + " & disown") i want to remove this os.system call
6
by: shellcode | last post by:
the code: ------fork.c------ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> int main() {
27
by: steve | last post by:
I was given the following code, and asked what the possible outputs could be. We're learning about processes and forking. int value; int main(){ int pid, number = 1; value = 2; pid = fork();...
11
by: ramu | last post by:
Hi All, We know that a c function never returns more than one value. Then how come the fork() function returns two values? How it is implemented? Regards
1
by: vduber6er | last post by:
Hi I want to have a wait page while the rest of the cgi does its process, but it seems like the wait page waits till everything is complete and never appears. I've tried forking twice already as...
3
by: thrillseekersforever | last post by:
The questions(A&B) are to fine no# of process running from the below codes. However, I couldn't decipher the solution. Will someone please throw some light on this? Thanks a lot!! A] void...
5
by: JoeW | last post by:
Now before I go into detail I just want to say that this is purely for my own benefit and has no real world usage. I remember way back when the tool for *nix systems called forkbomb was created. I...
3
by: CMorgan | last post by:
Hi everybody, I am experiencing an annoying problem with fork() and execv(). In my program I need to launch the "pppd" from a thread, so, I create a new process with fork and then in the child...
9
by: Gilles Ganault | last post by:
Hello I need to launch a Python script, and fork it so that the calling script can resume with the next step will the Python script keeps running. I tried those two, but they don't work, as...
2
by: Radz | last post by:
when the fork system call is executed, a new process is created. The original process is called the parent process whereas the new process is called the child process. The new process consists of a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.