Closed ta0kira closed 3 years ago
I've decided against this. The C++
version of Argv
is a part of the base because it needs to be set in main
, and lib/util
is just a wrapper around the C++ functionality.
There is nothing special about that implementation, and it doesn't fit within the theme of the other categories in the base: All other built-ins either have syntax for literals (e.g., String
, Bool
) or are interfaces that types with literals need to implement.
Supporting it requires code in
base
, and putting it inlib
requires that that code is visible to all extensions.This means at least the following:
Argv
fromlib/util
.Any module with C++ extensions can temporarily override
Argv
globally by putting aProgramArgv
on the stack during a function call. Although this in theory would be useful for testing purposes, this functionality can only be scoped to a C++ function.The example above cannot work because
argv
is a heap object and therefore cannot own aThreadCapture
instance. For this to actually work, the C++ extension would need to take a callback that gets executed while it has aProgramArgv
on the C++ stack.