> So the fix is to add:
> 
>   default command Timers.startPeriodic[int id](int interval) {
>     ... complain/handle/ignore unexpected call ...
>   }
>

That this command has to be written feels wrong for three reasons...
1) compiler error does not even talk about the need for a 'default',
    >> BlinkC.nc:51: Timers.startPeriodic not connected
    even when being on the right track you easily run inte other compile
    errors that won't help you toward the correct solution
2) has to be written
3) not in Timers.ncc (shouldn't all Timers.xx commands be in Timers.ncc?)
 
> Note that it would of course be possible to write an analysis that
> detected that in this particular program there's no need for a
> "default" startPeriodic command. However that would be a bad idea (in
> general at least), as:

> - it makes BlinkC less of a standalone component (the missing
> startPeriodic command will be needed for some wiring patterns)

But adding this to BlinkC.ncc gives the same problem, shouldn't really be added 
to BlinkAppC.ncc
Or can the compiler handle several modules defining this function? (each with 
its own unique count series?)
- this unique() / uniqueCount() stuff just don't feel right...

> - it makes code's correctness quite dependent on exactly what analysis
> is performed in the compiler to detect when default commands/events
> are not required (should 'for (i = 0; i < 2; i++) call
> Timers.startPeriodic[i](...);' work too?)

A lot more likely code would be

for (int i=0; i < uniqueCount("Timers"); i++)
  Timers.startPeriodic[i](...)

This pattern could be statically analysed and code generated. But if not 
wouldn't the compiler need to put a dispatch handling somewhere?
Why not in an automatically generated default function, calling something like 
handle_..._error() in default case?
And let the user define this 'handle_..._error' function instead!

And finally: Why doesn't isn't the Blink example code use this feature in the 
first place?

/RogerL
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to