14979Re: [Clip] Understanding Writing Subroutines
- Apr 14 8:48 PMsombody wrote;
> But don'tAnd here I thought you were a smart person???
> you guys think you're testing the limits of clip code?
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
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
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
Thems my thoughts on it.
- << Previous post in topic Next post in topic >>