whartung wrote:
The standard doesn't require block storage at all, those words are optional.
The file word set is independent of the block system, you don't even need to support it if you have the file words.
dpans94.asc, section 11.3.2 wrote:
If the File-Access word set is implemented, the Block word set shall be implemented.
Chapter and verse. Yes, the block word set is optional, except when certain of the file-access words (basically, anything that can actually manipulate or query a file or its contents) are implemented, or if BLOCK, FLUSH, or UPDATE is implemented. Oddly, the argument can be made that the rest of the block word set doesn't trigger the requirement of section 3.2.5 (see below for the quote) for including the entirety of the block word set.
JimBoyd wrote:
Let me guess, your implementation of
BLOCK and
BUFFER would be:
Code:
: BLOCK ( N -- ADR ) DROP TRUE ABORT" Block not present" ;
: BUFFER ( N -- ADR ) BLOCK ;
Talk about following the letter of the specification while ignoring the intent.
Close! But I like exception handling:
Code:
VARIABLE BLK
: BLOCK -35 THROW ;
: BUFFER -35 THROW ;
: FLUSH ;
: LOAD -35 THROW ;
: SAVE-BUFFERS ;
: UPDATE ;
And, yes, I acknowledge that this is entirely silly. Worse, the apparent "out" of declaring that a system implements all of the words of the file-access word set without declaring that it implements the file-access word set (thus avoiding the requirement of 11.3.2) falls afoul of 3.2.5:
dpans94.asc, section 3.2.5 wrote:
If a system provides any standard word for accessing mass storage, it shall also implement the Block word set.
Which, as we're about to see, was deliberate.
JimBoyd wrote:
Seriously, If such a technicality was acceptable to the standards team, then why require the block wordset to be present when support for files is present?
The actual justification is, in fact, given:
dpans94.asc, section A.7 wrote:
In order to guarantee that Standard Programs that need access to mass storage have a mechanism appropriate for both native and non-native implementations, ANS Forth requires that the Block word set be available if any mass storage facilities are provided.
Because merely declaring a dependency on the Block word set is, for some reason, insufficient. In a way, though, I'm glad to have this justification. It means that I may safely say "this is silly" and ignore it, instead of having to honor it because it might actually be important.