Re: function -> action

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007/8/7, Richard Lynch <ceo@xxxxxxxxx>:
>
> On Fri, August 3, 2007 1:38 am, Ralph Kutschera wrote:
> >   I'm working on a project, where we distinguish between "functions"
> > and
> > "actions" in design, although in PHP both are implemented as
> > functions.
> > Is there a chance that PHP can use the word "action" as "function"?
> >
> > E.g.:
> > public function doSomething() { .... }
> > public action doSomethingElse() { ... }
> >
> > ... is actually the same but would help to see the design also in the
> > code.
>
> You might be able to do this with the Run-Kit extension...


I was unaware that run-kit was able to do this kind of things, could you
explain a little more about how would this extension could handle code with
alien keywords.

It might be easier, however, to hack some kind of pre-processor that
> would search for PCRE '\\s*action\\s*' and replace it with ' function
> '
>
> You'd have to pre-process generate your actual PHP files that get
> executed, but the source you use would just have the 'action' in it.


Actually is not that simple. There are some considerations that should be
taken into account, such as the loss of error information (file and line
number where the error occurs) and exception information (stack trace does
not point to the right place), and parsing correctly the code as to replace
the action keyword where it actually applies. I made some experimentation
with preprocessing php code with added keywords, that might help you if you
wish to use such a solution:
http://www.phpclasses.org/browse/package/4001.html

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux