Ugh. Bogged down...

Jan Schenkel janschenkel at yahoo.com
Fri Jun 11 02:26:23 EDT 2004


--- Bob Nelson <bobnelson at mac.com> wrote:
> You're right regarding the 'no turning back' issue.
> Some of my employees
> were trying to take me off into Java-land, others
> insisted I needed to learn
> a "more powerful language" and suggested everything
> from C-sharp to D-flat.
> They were pretty funny to watch when I whipped out
> my old Mac and showed
> them the wonders of HyperCard...
> 

The closest thing to HyperCard on Windows I can think
of and that is wide-spread, is Visual Basic -- which
was prototyped in HyperCard -- go figure.
One of the evening classes I'm taking is VB.NET, and I
must say it has its share of quirks like any Microsoft
product, but I saw many good things too.

> [snip]
> 
> One of the lines provided to me says:
> 
>  repeat for each line tLine in tData
> 
> As I'm working with further 'massaging' of the
> grabbed text, I'm playing
> with some of this code and this one left me
> scratching my head (and there
> ain't a lot of hair up there!) -- what is the
> function of the (variable?)
> tLine in this text?  I didn't see it previously
> declared in the script and
> wondered why this wouldn't simply be:
> 
> repeat for each line in tData
> 
> Instead.  Again, I'm sure I missed something
> important, but I really AM
> paying attention.
> 

What happens in a 'repeat for each line' loop is that
the engine will know it is traversing the entire body
of text, and throughout the repeat, it will place the
next line into the variable 'tLine', while keeping
track of where it's at, thus saving valuable time.

Imagine processing 140K lines of text with the
following code :
--
repeat with i = 1 to the number of lines of tData
  put line i of tData into tLine
  ## do something with the data in tLine
end repeat
--
The engine will faithfully start from the top again
and again when you ask it for line i of tData, thus
going over lines it has already given you.

Now compare that with the following code :
--
repeat for each line tLine in tData
  ## do something with the data in tLine
end repeat
--
The engine knows where it was, and will just grab the
next line of the 'tData' variable and stick it into
the 'tLine' variable, instead of counting again from
the top of the variable content.

That's why this is potentially the most important
construct added to the language.

> I also wanted to comment that one of the reasons I
> decided to go with
> Revolution instead of any of the other suggestions
> is the tone and
> helpfulness of the members of this list.  I'm glad
> to be a member of a list
> where everyone seems to want to share ideas, rather
> than berate the newbies
> or 'one-up' the others on the list.  Hopefully the
> developers remember those
> who bought in at the ground floor when they're rich
> and famous...  (For
> those of you who've been around the Mac arena since
> 1983 (yes, I said "3"),
> think HyperCard, and FirstClass, etc.)
> 
> Thanks for the support!
> 
> Bob
> 

This list is indeed a great source of information, and
the members are more than happy to share what they
know with newcomers -- and I'm sure you'll be sharing
your experiences with newcomers in the future as well.

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the use-livecode mailing list