>>>>> "AS" == Aaron Sherman <[EMAIL PROTECTED]> writes:

  AS> On Mon, 2005-03-07 at 15:33 -0500, Uri Guttman wrote:

  >> >>>>> "AS" == Aaron Sherman <[EMAIL PROTECTED]> writes:

  >> see what i do in File::Slurp. i wanted a single error handling sub but
  >> also to have the croak in there report back from the original call (say
  >> read_file).

  AS> Tried that. Problem is File::Copy is the kind of thing that's going to
  AS> be called often and fast, and there's nothing short of an eval that
  AS> stops performance dead more than an subroutine call in Perl. Ah, Perl 6,
  AS> where are you?

did you do magic goto? it shouldn't be slow at it doesn't touch the
stack nor mung @_. i haven't benchmarked that aspect but file::slurp is
pretty fast. you could do worse than writing file::copy as

        write_file( $to, read_file( $from ) ) ;

:)

actually making those pass the text by ref (rtfm!:) is faster. true it
will flop on super large files which cause swapping.

but you could check the file size first and if small enough do that!

  >> it had was gotos and even then i structured my code as much as
  >> possible. i have never done spaghetti coding at any point in my
  >> career. maybe i have more innate understanding of logic than some but i
  >> always wonder how spaghetti coders think (or rather don't think! :).

  AS> Well, that's the point. The language is the tool, not the programmer.
  AS> You use the tool to perform the task at hand. If that means bending it
  AS> in funny ways, then that's what you do. Gotos are the programming
  AS> equivalent of duct tape. If you see duct tape, you know that there was a
  AS> limitation in the tool or the tool-user that made the duct tape
  AS> necessary. In this case, it was the tool, and in all these years, no one
  AS> has ever re-written that chunk of code without gotos and without a
  AS> performance or readability hit.

if i see gotos from a coder i respect, then that is true. but too often
they are the tool of the weak coder (like calling eval or using symrefs).

  AS> Like I say, it'll be a (not so) fond memory once P6 takes over the
  AS> world.

i am waiting patiently (really!).

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to