* Mark Overmeer (mark@overmeer.net) [110129 23:48]: > In ancient history, memory was short and modules were small. It is the > time of autosplit. However, I would call to reconsider autosplit for > POSIX.pm... The more I try to create a nice patches, the more worries I get. Maybe you share these concerns. For about 50 functions offered by POSIX, the name is directly calling a CORE function with the same name. Wouldn't it be cheaper to alias the names? In a dozen cases, the function maps to some perl internal: sub tolower { lc($_[0]) } sub getpid { $$ } In many, many other cases where that would also be possible, we do simply produce an error: # produces error "use method IO::Handle::flush() instead" sub fflush { redef "IO::Handle::flush()" } sub strlen { unimpl "strlen() is C-specific, use length instead" } Does anyone understand why some functions are accepted and others are refused? Suggestion how to formulate this rule as comment in the file? A non-breaking change for consistency would be to implement these functions as good as we can. They then change from run-time errors into well accepted. A seriously breaking alternative would be to degrade POSIX.pm into a module which only exports constants and functions which are not provided by the standard Perl interface (like ctermid()). The manual-page of POSIX already is quite detailed on the use of all functions. Most functions have important footnotes: we are not able to map POSIX one-on-one at all. Just a random example from the manual-page, to show a problem as purists like me have with the provided interface. From POSIX.pod fabs This is identical to Perl's builtin "abs()" function for returning the absolute value of the numerical argument, see "abs" in perlfunc. My POSIX manual says The fabs() functions return the absolute value of the floating-point number x. Perldoc -f abs says abs VALUE abs Returns the absolute value of its argument. If VALUE is omitted, uses $_. How identical are these two? . in Perl, abs also works with integer values . in Perl, the argument is optional . in C, you may need fabsf and fabsl alternatives They are very close for the good understander, but certainly not identical. So, IMO, we should prefer to limit the remark to fabs See "abs" in perlfunc. An experienced C programmer without sufficient Perl knowledge could use the POSIX man-page as translation table, but not as a way to attempt writing C program syntax in Perl. I would like to hear other peoples opinions. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.netThread Previous | Thread Next