problem with for...in

Dave Winer dave at userland.com
Sun Nov 3 08:59:57 PST 2002


Jan, is myTable the address of a table? It must be. That's how the for -- in
construct works.

I tried it out here, myself:

local (adr);
new (tabletype, @scratchpad.testtable);
for adr in @scratchpad.testtable {
 dialog.alert (adr)}

The dialog never appears, as one would expect.

Hope this helps.

Dave


----- Original Message -----
From: "Jan M.J. Storms" <jan at storms.org>
To: "Frontier Users" <Frontier-Users at userland.com>
Sent: Sunday, November 03, 2002 8:56 AM
Subject: problem with for...in


> I have the following problem with iterate thru tables:
>
> for adr in myTable {
> adr^.myValue = "this string"}
>
> will give me an error if myTable is empty. It complains that there is no
> item "item #1". If I check for the size of adr^ it tells me that it can't
> get the size of adr^. If i check for the name of adr^ it returns "item
#1".
>
> I think that if I do a for..in loop on a table that is empty the for...in
> loop should not be executed.
>
> A workaround at this time could be:
>
> for adr in myTable {
> try {
> sizeOf (adr^)}
> else {
> adr^.myValue = "this string"}}
>
> Is this something to be fixed?
>




More information about the Frontier-Users mailing list