DIRECTORY is unblocked upstream and can now be written #55

Open
opened 2026-08-05 23:00:44 -04:00 by tachikoma · 0 comments
Collaborator

DIRECTORY (and its alias CATALOG) has always refused, and the reason was that libakstdlib had no opendir/readdir wrapper — filed there as issue #10, and refused here rather than worked around, per MAINTENANCE.md.

That wrapper has landed. libakstdlib now publishes aksl_opendir, aksl_readdir, aksl_closedir and aksl_rewinddir, all in the house error convention, and akbasic pins a revision that has them.

So the blocker is gone and only the work is left. The dependency bump that brought the wrapper in changed the refusal from naming the missing wrapper to saying plainly that the verb is unwritten (src/runtime_disk.c:419), because continuing to blame libakstdlib had become false. tests/disk_verbs.c asserts both halves — that it says "not implemented", and that it does not still name libakstdlib. docs/09-files-and-disk.md, docs/11-verb-reference.md and docs/13-differences.md say the same.

What closing this needs

Decisions, more than code — which is why the bump did not just write it:

  • What a listing looks like. Commodore DIRECTORY prints a header line, one line per entry with a block count, and a BLOCKS FREE trailer. A filesystem has no 254-byte blocks. Either synthesise a block count from the file size, print byte sizes and accept that it is not Commodore-shaped, or something else — but pick deliberately and write it in docs/13-differences.md.
  • Which argument forms to honour. The dialect accepts DIRECTORY, DIRECTORY "PATTERN", and a drive/unit suffix. Commodore wildcards are * and ?, which are not glob semantics.
  • Where the output goes. Through the runtime's akbasic_TextSink, like every other printing verb, so it tees to stdout and the akgl text layer alike.
  • What it does with a directory it cannot read. AKBASIC_ERR_DEVICE with the errno libakstdlib propagated is probably right.

What it would touch

src/runtime_disk.c (akbasic_cmd_directory, currently a bare refusal), tests/disk_verbs.c (the refusal assertions above get replaced by real listing assertions against a fixture directory), a tests/language/ pair if the output is worth pinning byte-for-byte, and the three doc statements plus the MAINTENANCE.md paragraph that currently records this as unblocked-but-unwritten.

Blast radius is small: nothing calls akbasic_cmd_directory but the verb table, and no program can depend on the current behaviour except by catching the refusal.

`DIRECTORY` (and its alias `CATALOG`) has always refused, and the reason was that `libakstdlib` had no `opendir`/`readdir` wrapper — filed there as issue #10, and refused here rather than worked around, per `MAINTENANCE.md`. **That wrapper has landed.** `libakstdlib` now publishes `aksl_opendir`, `aksl_readdir`, `aksl_closedir` and `aksl_rewinddir`, all in the house error convention, and `akbasic` pins a revision that has them. So the blocker is gone and only the work is left. The dependency bump that brought the wrapper in changed the refusal from naming the missing wrapper to saying plainly that the verb is unwritten (`src/runtime_disk.c:419`), because continuing to blame `libakstdlib` had become false. `tests/disk_verbs.c` asserts both halves — that it says "not implemented", and that it does *not* still name `libakstdlib`. `docs/09-files-and-disk.md`, `docs/11-verb-reference.md` and `docs/13-differences.md` say the same. ## What closing this needs Decisions, more than code — which is why the bump did not just write it: - **What a listing looks like.** Commodore `DIRECTORY` prints a header line, one line per entry with a block count, and a `BLOCKS FREE` trailer. A filesystem has no 254-byte blocks. Either synthesise a block count from the file size, print byte sizes and accept that it is not Commodore-shaped, or something else — but pick deliberately and write it in `docs/13-differences.md`. - **Which argument forms to honour.** The dialect accepts `DIRECTORY`, `DIRECTORY "PATTERN"`, and a drive/unit suffix. Commodore wildcards are `*` and `?`, which are not glob semantics. - **Where the output goes.** Through the runtime's `akbasic_TextSink`, like every other printing verb, so it tees to stdout and the akgl text layer alike. - **What it does with a directory it cannot read.** `AKBASIC_ERR_DEVICE` with the errno `libakstdlib` propagated is probably right. ## What it would touch `src/runtime_disk.c` (`akbasic_cmd_directory`, currently a bare refusal), `tests/disk_verbs.c` (the refusal assertions above get replaced by real listing assertions against a fixture directory), a `tests/language/` pair if the output is worth pinning byte-for-byte, and the three doc statements plus the `MAINTENANCE.md` paragraph that currently records this as unblocked-but-unwritten. Blast radius is small: nothing calls `akbasic_cmd_directory` but the verb table, and no program can depend on the current behaviour except by catching the refusal.
Sign in to join this conversation.