Andrew Faulds | 5 Aug 2012 20:36

Re: [PHP-DEV] php interactive shell without readline

On 05/08/12 19:33, Ivan Enderlin  <at>  Hoa wrote:
> On 05/08/12 12:39, Andrew Faulds wrote:
>>
>> Great, but couldn't you type some command which would screw it up, by 
>> accident?
> What do you mean?
>
Say your implementation uses some global variable called $history. Now 
say I type "$history = [];" at the interactive prompt. Won't that break it?
>> Also I think UTF-8 (Unix) or UTF-16 (Windows) might be important.
> Exactly. I'm working on it.
>
> Best regards.
> -- 
> Ivan Enderlin
> Developer of Hoa
> http://hoa.42/  orhttp://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/  andhttp://www.inria.fr/
>
> Member of HTML and WebApps Working Group of W3C
> http://w3.org/

--

-- 
Andrew Faulds
http://ajf.me/

Ivan Enderlin @ Hoa | 5 Aug 2012 20:44
Gravatar

Re: [PHP-DEV] php interactive shell without readline

On 05/08/12 20:36, Andrew Faulds wrote:
> On 05/08/12 19:33, Ivan Enderlin  <at>  Hoa wrote:
>> On 05/08/12 12:39, Andrew Faulds wrote:
>>>
>>> Great, but couldn't you type some command which would screw it up, 
>>> by accident?
>> What do you mean?
>>
> Say your implementation uses some global variable called $history.
Not global variables but class attributes.

> Now say I type "$history = [];" at the interactive prompt. Won't that 
> break it?
Of course not. We read chars one by one on stdin. If a mapping is 
detected, then we call the associated callable. The line is never 
executing/evaluating as a PHP code (except if this is what you want 
obviously).

Cheers :-).

--

-- 
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/

Member of HTML and WebApps Working Group of W3C
http://w3.org/
(Continue reading)

Andrew Faulds | 5 Aug 2012 20:56

Re: [PHP-DEV] php interactive shell without readline

On 05/08/12 19:44, Ivan Enderlin  <at>  Hoa wrote:
> On 05/08/12 20:36, Andrew Faulds wrote:
>> On 05/08/12 19:33, Ivan Enderlin  <at>  Hoa wrote:
>>> On 05/08/12 12:39, Andrew Faulds wrote:
>>>>
>>>> Great, but couldn't you type some command which would screw it up, 
>>>> by accident?
>>> What do you mean?
>>>
>> Say your implementation uses some global variable called $history.
> Not global variables but class attributes.
>
>> Now say I type "$history = [];" at the interactive prompt. Won't that 
>> break it?
> Of course not. We read chars one by one on stdin. If a mapping is 
> detected, then we call the associated callable. The line is never 
> executing/evaluating as a PHP code (except if this is what you want 
> obviously).
Eh? I thought PHP interactive evaluated the code? What's the use of only 
being able to use functions?
>
> Cheers :-).
> -- 
> Ivan Enderlin
> Developer of Hoa
> http://hoa.42/  orhttp://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/  andhttp://www.inria.fr/
>
(Continue reading)

Ivan Enderlin @ Hoa | 5 Aug 2012 23:03
Gravatar

Re: [PHP-DEV] php interactive shell without readline

On 05/08/12 20:56, Andrew Faulds wrote:
> On 05/08/12 19:44, Ivan Enderlin  <at>  Hoa wrote:
>> On 05/08/12 20:36, Andrew Faulds wrote:
>>> On 05/08/12 19:33, Ivan Enderlin  <at>  Hoa wrote:
>>>> On 05/08/12 12:39, Andrew Faulds wrote:
>>>>>
>>>>> Great, but couldn't you type some command which would screw it up, 
>>>>> by accident?
>>>> What do you mean?
>>>>
>>> Say your implementation uses some global variable called $history.
>> Not global variables but class attributes.
>>
>>> Now say I type "$history = [];" at the interactive prompt. Won't 
>>> that break it?
>> Of course not. We read chars one by one on stdin. If a mapping is 
>> detected, then we call the associated callable. The line is never 
>> executing/evaluating as a PHP code (except if this is what you want 
>> obviously).
> Eh? I thought PHP interactive evaluated the code? What's the use of 
> only being able to use functions?
The code I presented only replace the readline functionnality (like 
Linenoise does). Then you can evaluate the code with the help of a 
temporary file, FastCGI & co., I don't know ;-).

Best regards :-).

--

-- 
Ivan Enderlin
Developer of Hoa
(Continue reading)

Andrew Faulds | 5 Aug 2012 23:04

Re: [PHP-DEV] php interactive shell without readline

On 05/08/12 22:03, Ivan Enderlin  <at>  Hoa wrote:
> On 05/08/12 20:56, Andrew Faulds wrote:
>> On 05/08/12 19:44, Ivan Enderlin  <at>  Hoa wrote:
>>> On 05/08/12 20:36, Andrew Faulds wrote:
>>>> On 05/08/12 19:33, Ivan Enderlin  <at>  Hoa wrote:
>>>>> On 05/08/12 12:39, Andrew Faulds wrote:
>>>>>>
>>>>>> Great, but couldn't you type some command which would screw it 
>>>>>> up, by accident?
>>>>> What do you mean?
>>>>>
>>>> Say your implementation uses some global variable called $history.
>>> Not global variables but class attributes.
>>>
>>>> Now say I type "$history = [];" at the interactive prompt. Won't 
>>>> that break it?
>>> Of course not. We read chars one by one on stdin. If a mapping is 
>>> detected, then we call the associated callable. The line is never 
>>> executing/evaluating as a PHP code (except if this is what you want 
>>> obviously).
>> Eh? I thought PHP interactive evaluated the code? What's the use of 
>> only being able to use functions?
> The code I presented only replace the readline functionnality (like 
> Linenoise does). Then you can evaluate the code with the help of a 
> temporary file, FastCGI & co., I don't know ;-).
>
> Best regards :-).
Oh sorry, I got confused. I see.
> -- 
> Ivan Enderlin
(Continue reading)


Gmane