Component Files and ⎕IO

No need to worry about going "off topic" here
Forum rules
This forum is for general chit-chat, not necessarily APL-related. However, it's not for spam or for offensive or illegal comments.

Component Files and ⎕IO

Postby ray on Mon Aug 30, 2021 2:21 pm

Components in a Dyalog Component file are allocated consecutively starting at 1 independently from the value of ⎕IO. This is inline with STSC's and Sharp's component files on mainframes if I remember correctly.

Now I come to think about it, this seems strange.

In general I prefer to work in ⎕IO 1, but have recently changed my ants visualisation class (running under MiServer) over to using index origin 0. This was partially because the documentation for the 2004 ICFP Programming Contest - "Dinner with Ambiants" was written in index origin 0. But also because Encode and Decode are a lot easier to use in origin zero, and my code was frequently out by 1!

In my mainframe APL days, "we" strictly observed standard layouts for component file which allowed utility programs to read them document them. (As Peter Merritt said: "Standards are good, everybody should have their own.")

In those days when, workspaces were small, component files were often used to split up large matrices into smaller batches that could be handled in the workspace.

The standard layout was along the lines of:
Component 1 - A short text description for the file and its name.
Component 2 - A text matrix index of the file, one row per component, describing what was i that component (This text)
Component 3 - A text matrix containing the full documentation about the file
Component 4 - The component number for the first batch of data (say 10)
Components 5-9 non standard utility information (such as look-up) or empty for future use
Component 10 - keys to the First batch of data
Component 11 - keys to the Second batch of data
Etc
In some respect this data started at origin 10!

Files for multi user update were more complex with for instance, alternate Index components, one for reading and another for writing.

For such component files I would have not considered using index origin zero for numbering the components.

Might there be a good case for allowing for a component Zero?
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 219
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: Component Files and ⎕IO

Postby Richard|Dyalog on Fri Sep 17, 2021 10:33 am

Component files exist outside of even a workspace (ties remain even if you )CLEAR ), so any kind of ⎕IO sensitivity is probably out of the question.

Component numbers are mostly used as labels; their exact numerical value doesn't seem too relevant to me and I'm not sure I think it would add much utility if there could be a component 0. It would add all sorts of incompatibilities too, and creating it would be "awkward" (because ⎕FAPPEND within a new file currently creates component 1). However, if a compelling case was to be made for the benefits of a component 0, Dyalog would of course consider it.

Aside: a curiosity of the Dyalog component file implementation is that there is a slot in the component index tree for a component 0, even though it is never used. (Although it disappears if you drop components from the start of the file).
User avatar
Richard|Dyalog
 
Posts: 44
Joined: Thu Oct 02, 2008 11:11 am

Re: Component Files and ⎕IO

Postby ray on Fri Sep 17, 2021 4:26 pm

Thanks for your thoughts Richard.

I have no real case for a component 0 (compelling or trivial).

The only reason I was even thing about this was I was storing 100,000 "steps" (numbered from 0-99,999) in a component files (components 1-100,000), and my coding got confused between "step numbers" and "component numbers" when reading in multiple steps ("batch sizes" of variable size, including zero), especially when running backwards. I have at least sorted this all out now.

Thanks
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 219
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK


Return to Chat

Who is online

Users browsing this forum: No registered users and 1 guest