What exactly are you trying to achieve with @enum Actions action? There are multiple issues with that line.
You cannot grow an Enum, it needs to be initialized with all the values, so calling @enum inside a loop makes little sense.
@enum is a macro, in other words, it takes code and outputs code. If you use @macroexpand in front of it you can see it creates a new primitive type Actions and define action to be a constant of value zero of these new primitive type. So, it does not look at what is inside action as a variable, it takes action as the code/string/expression “action”, independently of what is inside. In fact, there should be nothing inside, as all macro parameters should be unused identifiers.
What means making an Action object a value of the Actions enum? Enums are basically a wrapper for non-negative numbers, so numbers identifying different things (e.g., car model number and car color, for example) are not confused and mixed. Enums are not made to wrap arbitrary composite values as your Action objects.
I am not sure if you can convert a vector into a Enum without the use of eval (that has its own problems). But I think you probably are misusing Enum, and whatever problem you have this is not the way to solve it.
I maybe will need a bit more information than that.
Why do you not use the numbers from 1 to 1296 as you are using in your example (or more generally, either collect(keys(AS)) or 1:length(AS))? What is stopping you from doing that.
julia> using Random
julia> a = shuffle!([1,2,3,4,5,6])
6-element Vector{Int64}:
4
5
1
2
3
6
julia> eachindex(a)
Base.OneTo(6)
julia> collect(keys(a))
6-element Vector{Int64}:
1
2
3
4
5
6
Base.OneTo(6) is tiny, it only stores the maximum index and iterating over this already gives you each index of a (in this case starting with 1). collect(keys(a)) allocates a new vector of the same size as a, containing each individual index in memory. However, you don’t actually need to store every index ahead of time, especially if you’re only iterating over them. Storing every possible index physically in memory is quite wasteful, especially when the incoming array is large.