Description
With the introduction of the print
function, there's not much motivating the use of trace
. The print
function has a number of advantages over trace
:
- Gracefully deals with undefined values
- Varargs - not required to use
sprintf
for printing multiple variables or values - Does not require special flags to
opa eval
or query params foropa run
- Elided by compiler in production (i.e. when running the server with
--log-level=error
)
Having two built-ins with nearly identical purpose however isn't ideal, and we'd rather have users go use print
for the purpose of debugging. Tracing is of course still available for when that is needed — the trace
function simply adds a note in the trace.
Creating an issue here for discussion, as there could be use cases for this I haven't thought of. And just to be clear: deprecation does not mean removal, but simply that we'd delist it from the docs, or even list it as deprecated with a pointer to use print
instead, and that an error will be emitted by the compiler when --strict-mode
is enabled.