On Mon, 2002-05-06 at 00:31, Tom Robinson wrote: > As a programmer fairly new to the PHP socket functions, there is a long enough list >of them already. > For the most part, they match the C functions. > socket_last_error() doesn't have a C equivalent, because of the difference in >environment. > But in the PHP tradition, socket_last_error has two flavours, where the shortest one >is the one that can be used 90% of the time.
I understand that you were just looking for a shortcut, and your suggestion does create a good shortcut for the way you you are using socket_strerror(). The only reason I had a problem with the suggestion is because it did not apply to all uses. I realize that you may use socket_last_error() with no sock arg 90% of the time, but use will vary depending on application. > I personally would not want to see yet another function for socket_last_errstr() - >ever time a new function is added to the list, it makes the list a little bit longer >and a little bit less approachable for newcomers. My suggestion was to shorten up the >case where socket_strerror is used 90% of the time. Ok, no problem, it was just an alternative suggested that would have implemented the functionality you requested, except it would have applied to all cases. I disagree with you that adding a shortcut to a function that was not designed to behave in that manor is any easier to understand than a new function that spells out the expected behavior. I do agree that an extension can pollute its namespace with unnecessary functions. > I would extend my suggestion to say I would NOT want a new socket_last_errstr($sock) >function. > It was just a simple little suggestion for a coding shortcut, with no new >functionality added, therefore not worthy of its own new function. > Since no new functionality is added, I can (and did) code my own in PHP for use >after almost all my socket calls. > ...Tom > That is a good thing. An application should always have a custom error wrapper, because the API will never provide all the desired functionality within the lifespan of an application. -Jason > >I think the requested behavior does not belong in socket_strerror() > >simply because it would not match the primary and other use of > >socket_last_error(). In other words, you would not be able to replace > >the behavior of > > > >socket_strerror(socket_last_error($sock)); > > > >What could be possible, would be to add something like > >socket_last_errstr, which could then follow the same semantics of > >socket_last_error. This would be a much more consistent. > >i.e. > >socket_last_errstr($sock); > >socket_last_errstr(); > > > >Would this be acceptable? > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php