File Metadata
- Created
- Fri, Mar 13, 3:12 AM
Introduction
A Containers is a general name for data structures intended to hold group of elements of certain type.
Considering that almost every program needs containers to store, retrieve, search or otherwise process aggregate data,
obviously efficiency of containers implementation is one of the top priorities for Xreate design.
Main idea behind containers in Xreate is to gather information on how containers are used, inferred from program sources.
On this ground it's possible to choose semi-automatically most appropriate data structure for container implementation to efficiently fullfil particular needs.
a= [1, 2, 3, 4, 5]:: [num]; impl(solid). //container definition b= a[0]:: num; op(randaccess). //operation on container
In this example, definition of container(variable a) offers one or several implementations it supports, that is impl(solid) which
is explicilty provided for clarity. On the other side, retrieving by index operation(variable b) demands certain implementations
to operate. Annotation op(randaccess) explicitly describes operation nature, i.e. it requires any data structure that supports random access .
Based on gathered information, most appropriate tradeoff in supply and demand is applied as given container implementation, i.e. impl(solid) in this simple case.
In order to exppress possible and required implementations, describe operations, constraints and preferences an annotations are used, either manually provided or automatically inferred from program sources.
Container definitions
Container operations
| map loop | op(seqaccess) | impl(on_the_fly), impl(solid) |
| fold loop | op(seqaccess) | impl(on_the_fly), impl(solid) |
| index retrieving | op(randaccess | impl(solid) |