[m-dev.] Socket Library

Paul Bone pbone at csse.unimelb.edu.au
Wed Oct 20 08:39:34 AEDT 2010


On Tue, Oct 19, 2010 at 05:04:20PM +0100, Daniel Waterworth wrote:
> Hi,
> 
> I'm making a socket library in mercury. It works (I have sent simple
> HTTP requests using the code I've written and it supports IPv6), but
> as it stands it doesn't check for errors. So, how should C code go
> about raising exceptions? I haven't found any documentation on the
> subject.

Hi Daniel,

It's better to raise an error as a type alternative using the type
system.  Exceptions are for truly exceptional things, errors in the use
of sockets aren't exceptional.

Take a look at the source code of the io module in Mercury's standard
library to see how errors are reported there.

Good luck.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/developers/attachments/20101020/acadc605/attachment.sig>


More information about the developers mailing list