This repository has been archived by the owner on Dec 18, 2020. It is now read-only.
Should there be a makeArray primitive, and for what? #27
Labels
question
Further information is requested
Currently we have a
makeArray
primitive that works very much like an array literal, except that it works with elements that are expressions, instead of plain data like literals do. Currently we only generate code formakeArray
if indices are constant (we know which element to pick at codegen time).Why can our normal array literals not contain arbitrary expressions?Personally, I would like to solve both of these questions by removing the
makeArray
primitive. Instead of plain data, normal array literals would take elements of expression kind.Additonnaly, a
selectArray
-- or differently named high-level construct -- would also allow to create arrays as a combination ofgenerate
andselect
. This would generate C code with if statements or ternaries to pick the right element. If indices are constant, we should simplify the branching away.@rise-lang/core
The text was updated successfully, but these errors were encountered: