Euphoria Ticket #602: sockets:socket documentation

The documentation states that this function should return -1 on failure. In fact, the function returns -38 and assigning this value to connectionSocket causes a type-check failure:

include std/socket.e  
socket connectionSocket = sockets::create(AF_INET, SOCK_STREAM*50, 0)  

Please correct documentation or function.

Details

Type: Bug Report Severity: Textual Category: Documentation
Assigned To: SDPringle Status: Fixed Reported Release: 4.0.0
Fixed in SVN #: View VCS: none Milestone: 4.0.4

1. Comment by jimcbrown Feb 06, 2011

At one point in time, create() returns -1 on error and then there was a separate function to get the actual error code. Just like getting errno or calling GetLastError() in W32API.

This was scrapped and never became part of a release. Instead, the error code is now returned directly by the function that reports it.

I believe that the function is correct, but the documentation was simply never update.

I also have to backtrack from the type check error. The socket type will only validate valid sockets. Socket errors thus fail, and when you assign one to a variable of type socket you get a type check error.

This is a fail-early philosophy. (If your code isn't properly detecting and handling these errors, better to fail now than silently ignore the error and cause things to go awry later.) I might not like it, but that philosophy is a big part of Euphoria 4.0's current design.

2. Comment by SDPringle Jun 30, 2011

Rather than finding bugs that don't match the documentation, we look at the code and then check to make sure the documentation is in agreement with it. We change the docs to fit the code. I may not like this, but this is the way the work flow operates.

3. Comment by SDPringle Jul 01, 2011

fixed in change-set c0a2e1f94515

Search



Quick Links

User menu

Not signed in.

Misc Menu