On Sun, Aug 29, 2004 at 03:45:22PM +1000, Russell Penney wrote:
I must admit I do not see the reason behind putting this sort of code in the Squeak side. I see it as extremely ugly.
The "just do something like..." below is fine if you are looking at a Mac but add PC, Unix (several flavours), Acorn, Handhelds, etc and the code starts becoming a dog's breakfast!! Much like FileDirectory handling is now (lots of lovely exceptions scattered throughout the image).
Well, no, it doesn't need to be organized poorly. See OSProcessAccessor and subclasses (in OSProcess package) for an example of how to approach it.
Why not have the primitives return a symbol which is a POSIX error name? We have a list of codes that can be returned from the Socket primitives and each platform VM is coded to that standard. Then you don't need to know what error code on each platform is, the code in the Squeak side is standard and you don't need a platform mapping class. Plus people who know POSIX stuff :) can at least make some sense of what is going wrong.
But yes, I agree that your suggestion here might be a simpler approach for reporting socket errors. (I'm no expert on POSIX sockets, so I don't know if this is workable across a range of platforms.)
Dave