monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] RFC: lua output redirection


From: Thomas Keller
Subject: Re: [Monotone-devel] RFC: lua output redirection
Date: Sat, 08 May 2010 14:28:52 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b2pre Thunderbird/3.0.4

Am 07.05.10 21:22, schrieb Pasi Parviainen:
> On 7.5.2010 2:50, Thomas Keller wrote:
>>
>> Hi all!
>>
>> I'd like to hear your comments on a small hack which I added to our lua
>> hooks code: output redirection for print() and io.write().
>>
>> The rationale behind this is that lua code (be it hooks or even custom
>> commands), which likes to "talk" to the user, most likely use the above
>> mentioned built-ins. These however work directly on STDOUT and this
>> imposes at least three problems:
>>
>> 1) users cannot distinguish lua output from the application's normal
>> output
>>
>> 2) like 1), but even worse for (remote) stdio: for remote_stdio the
>> problem is that the user does not even see it (while he maybe wants to),
>> while for normal stdio the output possibly leads to parsing errors
> 
> This would really be an issue for a user written commands. I would
> prefer to have old behavior for local interactive and scripting use
> cases, at least in user registered commands context.

The problem is that we don't make much of a difference here code-wise.
You're right that user commands which use plain print() commands would
eventually produce garbled output, but then again what we could do here
is to provide P() and W() functions just as we do for the C++ side and
encourage the explicit usage of io.stdout:write() for anything else.

> The rationale here is that, when user registered commands are used, user
> must be aware of those commands in the first place and the output
> generated must be from those user registered commands.

Sorry, I don't understand that. Could you elaborate a bit?

> Use cases in the context of hooks and remote stdio are different. Is it
> even possible to invoke user written commands thru remote stdio or are
> possibly those messages generated by print from the hooks?

No, remote stdio can only invoke automate commands, just as stdio does.
But we might support Lua commands in automate for the future as well,
why not. Since all automate commands have to write to a special ostream
object, the usage of plain print() calls wouldn't then be possible, though.

Thanks for your feedback,
Thomas.

-- 
GPG-Key 0x160D1092 | address@hidden | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=en

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]