Commit Graph

9 Commits

Author SHA1 Message Date
Kartik K. Agaram fffcc8b9ab stop running task.scheduler by default
sieve.tlv is 50% slower (18s vs 12s) with the new function call
instrumentation.
2022-03-16 21:38:34 -07:00
Kartik K. Agaram ab89be1ed3 Teliva's been broken 2 days while I mess with docs 2022-03-15 16:00:08 -07:00
Kartik K. Agaram 1017e80fe5 less confusing error when apps get past main 2022-03-13 12:12:19 -07:00
Kartik K. Agaram db7fd08e05 extract a helper
I'm starting to get quite indisciplined about where I introduce global
bindings. Seems reasonable since any modules in Teliva will come from
within the framework.
2022-03-06 08:41:45 -08:00
Kartik K. Agaram f2d29c22f8 a simple hack to make caller apparent
Teliva isn't yet smart enough to know the caller of an indirect function
where the function being called goes through a local variable.

I'd expected fixing this to be a long death march. However, there's a
shockingly easy fix: just make every indirect call go through an
additional direct function call.

My policy for zet.tlv was that function 'main' could open any file. This
stopped working since I introduced spawn_main. But with this commit it's
working again.

I can also drop all my special-casing of 'main' since it's now a regular
Lua call.

We still can't rely on the caller of an indirect call. That affects
start_reading and start_writing, which really need to be part of the
framework.
2022-03-05 22:38:00 -08:00
Kartik K. Agaram 52ae23784b new API for file operations
File operations now always return a channel (or nil on error or
permission denied).

When start_reading() from a filename, you can repeatedly :recv() from
the channel it returns.
When :recv() returns nil, you're at the end of the file. Stop.

When you start_writing() to a filename, you can repeatedly :send() to
the channel it returns.
When you're done writing, :close() the channel. Writes to the file won't
be externally visible until you do.

To make this work I'm now always starting up the scheduler, so I need to
fix sieve.tlv.

Transparently running the scheduler is an abstraction, and whenever I
create an abstraction I always worry about how it might fail. There's
a hopefully-clear error when you read past end of a file.
2022-03-05 18:04:35 -08:00
Kartik K. Agaram 983285c6b2 more unobtrusive skip message
In particular, the periods looked like passing tests.
2022-03-03 22:06:44 -08:00
Kartik K. Agaram 891bced544 always run unit tests for channels and tasks 2022-02-26 22:57:48 -08:00
Kartik K. Agaram 42526cb15d import https://github.com/majek/lua-channels
Also a little test program to demo channels in action.
2022-02-26 22:48:48 -08:00