php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55617 make array to support mode class
Submitted: 2011-09-06 07:52 UTC Modified: 2015-01-05 22:21 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: kexianbin at diyism dot com Assigned: danack (profile)
Status: Not a bug Package: Class/Object related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
22 - 19 = ?
Subscribe to this entry?

 
 [2011-09-06 07:52 UTC] kexianbin at diyism dot com
Description:
------------
In my mind, we phper can thoroughly throw away the concept of Object(class instance), we only need Array and Mode Class:

All arrays in initial mode support any array function as it's method:

<?php
$array1->array_flip(this);
?>

Use "->mode()" to validate the minimal data set, and then switch mode class:

<?php
$array1->mode('class1', $success);
?>

Any mode class has no "construct()" in it, but has "validate()" to validate the minimal data set.

The array in a mode still could use array function as its method, but after using any of them the array will be switched back into basic array mode, and we need to use "->mode('class1', $success);" to switch mode back.

The radical thought is data-centric programming, we need seperate the data(array) and the activity(class method).

We could modify php engine, to get rid of parts of OO(object oriented), and support Mode Class, we could call it MyPHP.

For example: $array_man1 could be set into two modes:cls_normal_man and cls_crazy_man:

<?php
$array_man1->mode('cls_normal_man')->normal_method1()->mode('cls_crazy_man')->crazy_method1();
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-22 04:02 UTC] kexianbin at diyism dot com
It's easier to realize MyPHP(Mode Class PHP) based on quercus,
because "you doesn't need to write a super GC or JIT to be fast(like in C), only a compiler".
 [2015-01-05 22:14 UTC] danack@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: danack
 [2015-01-05 22:14 UTC] danack@php.net
Please discuss fundamental design changes on the internals list or in IRC.
 [2015-01-05 22:21 UTC] danack@php.net
-Status: Closed +Status: Not a bug
 [2015-01-05 22:21 UTC] danack@php.net
Just been informed that "Not a bug" is a better setting than "closed".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 22:01:30 2024 UTC