Loading ...
Sorry, an error occurred while loading the content.

14979Re: [Clip] Understanding Writing Subroutines

Expand Messages
  • Don - htmlfixit.com
    Apr 14 8:48 PM
      sombody wrote;
      > But don't
      > you guys think you're testing the limits of clip code?

      And here I thought you were a smart person???
      The Answer: Of course not, clip code has no limits ... only limits on
      how you can get it to do it ... not whether it can do it.

      But more seriously, I would say no for the following reasons:
      1. I often and regularly write clips for other people for fun and/or
      very modest profit ... and they often don't have perl/gawk/etc. so I
      would have to get them to where I am with a language installed locally
      instead of just writing the clip.

      2. I often write a clip and email it to someone when I will be helping
      that someone else. I then only need to install notetab light on their
      computer and run the clip ... same point, I haven't cluttered up their
      computer with a program they won't later use (cause they will use
      notetab but not perl later).

      3. Why do it the easy way when the very reason I compute is for the
      challenge of it? To me this is like doing jigsaw puzzles. It keeps me
      sharper than I might otherwise be (don't even ponder how dense that
      might be).

      4. There often is a better tool to do job a OR b OR c, but seldom one
      that can do a AND b AND c ... but notetab can.

      I have taken to writing subroutines (if that is what we will call them)
      after our prior discussions unlocked the concept a little further. I
      have come to find them very handy. I will pass parameters by using a
      two line call:
      line one sets the variables that will be used in the subroutine
      and line two calls the subroutine that then has those variables
      available to it when it runs ...
      and when I get back, the variables are essentially the returned values
      because they are again available in the clip.

      Because in this example the "function" to be performed in the subroutine
      is a one liner, there is no advantage to the subroutine, but if the
      subroutine is a 30 line thing ... well then yes it would be worth it if
      reused.

      I also find it a great way to write portable bits of code. For example
      I wrote one to adjust back and forth between light and pro for the
      replace line feed situation (that I call a bug). I have used the same
      subroutine to correct that in several clips now by calling it as a
      subroutine clip.

      Thems my thoughts on it.

      D
    • Show all 11 messages in this topic