Re: async networking (was Exploding feature set)

Paul Prescod <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Mark Hahn wrote:

>>>Aside:
>>>I like the way twisted implements networking and
>>>protocols. This is not the same as saying I like the
>>>twisted implementation. Whether or not we need async
>>>networking will depend on whether prothon has the same
>>>problems as python when it comes to threading and so
>>>on. The separation of transport and (application)
>>>protocol is a good idea though.
>>
>>actually async programming is orthogonal to threads. See dan kegels 10K
>>page for some reading on this.
>>
>>(Short version: os threads @ 1 per cpu in the box, async within each
>>thread (which can be coroutine based as an implementation), gives you
>>greatest scalability).
> 
> 
> With our new stackless proposal we will have both bases covered.  We should
> make sure networking works well with both.

No, I don't think so. If you want to properly support asynchronous 
programming then I think that you need a bunch of asynchronous 
libraries. Like a non-blocking version of file.read(), a non-blocking 
form of urllib() an so forth:

"The event loop is implemented atop operating-system-specific APIs. This 
includes the standard select() system call, available on both Unix and 
Windows, as well as other platform-specific event loops. Although the 
networking code is generic, the event loop implementation is exposed to 
developers who require platform-specific functionality, be it file 
descriptors on Unix or events on Windows. In addition, the event loop 
can integrate with GUI toolkits (GTK, Qt, Win32, Mac OS X's Cocoa, and 
so on), allowing generic networking code to be used for GUI clients as 
well."

Tcl also has a first-class event model:

http://wiki.tcl.tk/489
http://wiki.tcl.tk/1772
http://wiki.tcl.tk/1527

C# also has first-class events but I don't know how they 
compare...perhaps not at all.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_10_7.asp

One big reason to want to do event-driven stuff from the start in the 
language (or at least in the standard library) is that you might want to 
have a SINGLE event loop for all event-oriented code: e.g. so you could 
mix code waiting for a file to open with code waiting for information 
from a network socket with code waiting for user input.

Prothon can't do everything but if you think you might want it to be a 
good platform for event-driven, asynch programming, it would be helpful 
to find some Twisted experts and ask them what they would like from a 
programming language by way of support.

  Paul Prescod
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.