perlang-org / perlang

The Perlang Programming Language
https://perlang.org
MIT License
16 stars 1 forks source link

Add Perlang array support #487

Closed perlun closed 2 weeks ago

perlun commented 3 months ago

Moved to GitLab

Please continue to the new version of this issue here: https://gitlab.perlang.org/perlang/perlang/-/issues/487. The GitHub page you are currently reading will not contain the latest information on this issue.


Here's a quote from myself in a commit message for what I just planned to start working on (yes, I sometimes write the commit message before writing the implementation. :slightly_smiling_face:)

Perlang arrays are implemented as instances of our C++ PerlangArray (non-template) type. The generic part of it is implemented on the Perlang side; the actual arrays store essentially a fixed-size C array of void * pointers which are cast to the appropriate type in the generated C++ code. We also special-case certain types like IntArray, LongArray and so forth, for the value types currently supported in Perlang.

I might not implement all of this in a single PR/branch, so I'm copying it here to keep it as some form of "design notes" for this feature.

Also, we might be able to deviate a bit from the above; we can even add StringArray to make it fully "specific" for now. Since there's not really any way to declare user-defined types at the moment (neither classes nor structs), we only need to support arrays for the Perlang-predefined types since that's all you'll ever going to need as a Perlang developer right now.

perlun commented 1 month ago

Has been started in #494 and #496 (i.e. milestone 0.5.0), but the feature is not really "complete" in that sense. Marking as 0.6.0 for clarity.