The solution is $("$name").
Full code:
macro const_from_env(const_name::Symbol, const_type::Symbol, default_value)
esc(quote
const $(const_name) = parse($(const_type),
get(ENV, $("$const_name"), $("$default_value")))
end)
end
@const_from_env CONST3 UInt16 30
@assert 30 == CONST3