Mark J. Reed wrote:
A few months ago (or maybe more) I proposed making pathnames their own
type, distinct from (or perhas a subclass of) strings, but easily
constructed from strings, maybe with an operator.  Having those 29
single-letter methods on such a class would not bug me as much as
having them on Str.

On 7/9/09, Aristotle Pagaltzis <pagalt...@gmx.de> wrote:
* Moritz Lenz <mor...@faui2k3.org> [2009-07-10 00:25]:
stat($str, :e)          # let multi dispatch handle it for us
This gets my vote.

I agree. The built-ins of basic types like Str or Int etc need to stay pure and just be about dealing with local data. Having methods on basic types for going out into the wider environment like the file system is just plain wrong. There should be separate IO classes for things like stat, which *use* basic types like Str for their interface definitions, and the full definition of Str/etc should not include any file-system operations.

If you go ahead and put stat ops in Str anyway, then you might as well put things like a delete_from(Hash $arg) method on Object, which is a less objectionable version of such backwardness.

-- Darren Duncan

Reply via email to