External Issue: [Feature Request] Method to get underlying type for atomics

20182, "thomasrolinger", "[Feature Request] Method to get underlying type for atomics", "2022-07-08T19:14:19Z"

This is a feature request that would allow users to "extract" the underlying type from an atomic type.

For example, if we have type t = atomic int, we could determine that the underlying type is int. The isIntType() procedure currently returns false when given atomic int. So that could be modified to return true in the case of atomic int. Another possibility is a separate isAtomicInt() procedure, or just a procedure on atomics to return the underlying type

As @lydia-duncan mentioned on Gitter, we can currently do:

var x : atomic int;
writeln(x.T : string); // prints int(64)

but it was noted that it may not be recommended for production code (i.e., too much in the weeds of implementation).

For my own use case, I would prefer something that would be given the atomic type and returned the underlying type (i.e., type s = getBaseType(atomic int)), but I could make due with any of the possibilities mentioned above.