joshuabenuck / seran-wiki

Experiment to create a Deno based implementation of Federated Wiki
MIT License
11 stars 7 forks source link

process steps in a nested loop #7

Closed WardCunningham closed 4 years ago

WardCunningham commented 4 years ago

Darn. I thought I was making a small step but I can't get this change to compile. What am I missing?

WardCunningham commented 4 years ago

This is the error that I don't understand.

ward@3d denowiki % ./denowiki.sh --meta-sites-dir=./meta-sites@localtest.me
{ _: [], meta-sites-dir: "./meta-sites@localtest.me", port: 8000, meta-site: [] }
error: Uncaught ReferenceError: exports is not defined
► file:///Users/ward/FedWiki/deno/denowiki/meta-sites/du.localhost.js:38:1

38 exports.__esModule = true;
   ^

    at file:///Users/ward/FedWiki/deno/denowiki/meta-sites/du.localhost.js:38:1
WardCunningham commented 4 years ago

I tried commenting out my code but that produced type checking errors that made even less sense to me. I felt like typescript was telling me that I was unqualified to even try to run this program. This may in fact be true.

joshuabenuck commented 4 years ago

Why do you have a .js file in meta-sites? I tried running from a fresh checkout and do not have any .js files there.

joshuabenuck commented 4 years ago

I had to make some changes to get it to compile:

let c0, c1, c2 = 0;
let l0, l1, l2 = 5;

async function* run() {
  for (c0 = 0; c0<l0; c0++) {
    yield `outer loop step ${c0} of ${l0}`
    for (c1 = 0; c1<l1; c1++) {
      yield `middle loop step ${c1} of ${l1}`
      for (c2 = 0; c2<l2; c2++) {
        yield `inner loop step ${c2} of ${l2}`
        await delay(100);
      }
      await delay(1000);
    }
    await delay(10000)
  }
}

Note the use of , instead of = in the assignment and the use of ; instead of , in the for loop.