RedGear-Studio/Atlas77

Add Array support (v0.0.3)

Gipson62 opened this issue · 0 comments

Description: In order to provide more versatile data structures, we plan to add support for arrays in the upcoming v0.0.2 release. Two types of arrays will be supported: DynamicArray (similar to Rust's Vec) and StaticArray (an array with a fixed size).

Some specific features that we plan to include in the v0.0.3 release are:

  • The ability to define and initialize arrays with a syntax similar to
let my_array: StaticArray<int: 10> = {5}; //Initialize all the index value at 5
let my_array: DynamicArray<int> = [10, 9, 0, 42]; //Can't initialize all the index value, cause you don't know the lenght of the array.
//But you can obviously specify a default lenght for a DynamicArray, the process is similar than for a StaticArray.
  • Support for accessing and manipulating individual elements of an array using the [] operator
  • Support for iterating over an array using a for loop
  • Support for expression inside the size definition of an array, to provide a way to create StaticArray of different size depending on your needs.
  • Basic array methods like push(), pop(), insert() for DynamicArray only and remove() and len for both array types.

remove() will just set the value to the default value of the type in the specified index for the StaticArray.

Adding array support will significantly enhance the language's capabilities and provide users with more powerful data structuring options. This feature will be especially useful for applications that require storing and manipulating large amounts of data.

By adding array support in v0.0.3, we can make the language more versatile and useful for a wider range of applications. This will help us build a stronger community and encourage more people to use and contribute to the language.