struct #7

Closed
opened 2026-04-10 14:35:13 +00:00 by jaynuine · 1 comment
Owner

by storing the stride of an array in the array itself, as opposed to potentially requiring a dedicated argument on a per method basis,

  • not only are we further reducing boilerplate
    • (as we did in going from {pointer, length} as individual arguments to a single struct containing both in method prototypes)
  • but this also allows for the input array's stride to differ from that of the output, e.g. in array::map #3

since the stride is stored at the array level and not per element, consider using a list1 instead for heterogeneous storage


  1. continuous array of references, where pointers abstract the stride variance of individual elements away from the array's memory by providing fixed size addresses in their place.
    this adds a level of indirection, and requires additional space in order to store the strides of every element ; either as wrapper structs ({address, stride}), or by storing a parallel index synchronised set of strides ↩︎

by storing the stride of an array in the array itself, as opposed to potentially requiring a dedicated argument on a per method basis, - not only are we further reducing boilerplate - (as we did in going from {pointer, length} as individual arguments to a single struct containing both in method prototypes) - but this also allows for the input array's stride to differ from that of the output, e.g. in array::map #3 since the stride is stored at the array level and not per element, consider using a list[^list] instead for heterogeneous storage [^list]: continuous array of references, where pointers abstract the stride variance of individual elements away from the array's memory by providing fixed size addresses in their place. this adds a level of indirection, and requires additional space in order to store the strides of every element ; either as wrapper structs ({address, stride}), or by storing a parallel index synchronised set of strides
jaynuine added this to the spec project 2026-04-16 19:35:18 +00:00
Author
Owner

should the raw and length fields be moved to their own substructure abstracting a memory region ? like a pointer with a length

should the raw and length fields be moved to their own substructure abstracting a memory region ? like a pointer with a length
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaynuine/pearr#7
No description provided.