GEdit OPI plugin

Simon van der Linden lists at simon.vanderlinden.eu.org
Mon Feb 18 14:31:45 CET 2008


Yves Jaradin wrote:
> Le samedi 16 février 2008 à 23:55 +0100, Simon van der Linden a écrit :
>> The second thing is that I don't get really well the design of the OPI 
>> functor. Why does it open an inet socket, which binds on a random port 
>> on every interface? Why not an unix one? It would be easier than reading 
>> the stdout to get a list of the port digits ;-)
 >
> Portability. Unix sockets are, well, Unix-only and don't have much
> support in Oz. Also the OPI functor I wrote for this gedit prototype is
> quite generic and could be used by other plugins for other editors
> regardless of the platform.

But that means that when the socket is listening for a connexion, anyone 
can use it, not only the localhost! Isn't it any way to bind it to local 
interfaces only?

>> I'll have a deeper look at the OPI asap, but I'm wondering if it exists 
>> some doc about the "protocol" somewhere on the Internet. Could you help me?
 >
> Considering that the source is available and in a documented programming
> language, yes it's kind of documented ;-) 

If you think that your code, with the help of the Mozart documentation 
is self-explained, you are wrong.

Roughly speaking, I find your code very difficult to understand. There 
isn't any comment line, and it looks like a single bloc, with plenty of 
nested function calls ;-)

> Of course, I will help you
> where I can. In the current/old OPI, two protocols are defined. On is
> actuallly used but quite ad-hoc, the other is cleaner, not used and
> incomplete. The prototype/new OPI protocol is inspired by this last one.
> The idea is that a message is a list of strings. For this, three special
> characters are used. One to separate messages, one to separate the
> strings inside the message and one as an escape so that the strings can
> contain the special characters.

So far, I don't understand the use of "obscure" characters as 
delimiters. If you do escape these characters in the string you send to 
the server, why don't you use parenthesis, colon, semi-colon or so?

Also, why do you need three channels to get information from the OPI 
process? I only see the need of an error channel, and an output one.
And why don't you use the stdin of this process to send information, but 
a socket instead?

Briefly, why do you use a socket?

Regards,

-- 
Simon van der Linden

http://simon.vanderlinden.eu.org/


More information about the mozart-hackers mailing list