ats

How can I get refer to the statically known size and type of a literal array?


For example,

#include "share/atspre_staload.hats"

implement main0() =
        let
                var A = @[int](1, 2, 3, 4, 5)
                val n = 5
                val what = "int"
        in
                println!("the array A contains ", n, " elements of type ", what)
        end

how could I define n and what with reference to A?


Solution

  • The short answer is that you could not because neither 'n' nor 'int' is in the dynamic representation of A.