so I could write a macro, that uses this function.
Example for some debug functions:
(import macros)
(using-namespace std.macros
(def print-status (macro intern (x)
(qq printf (if (get-status (uq x)) "Correct\n" "Incorrect\n")))))
(def main (fn extern-c void (void)
(def get-status (fn intern bool ((error-code int))
(or (= 0 error-code) (= 47 error-code))) ;error-code 0 means no errors, 47 also can be ignored
(def get-status (fn intern bool ((object (p void)))
(!= object (nullptr (p void))))) ;nullptr means no object allocated, so an error
(let ((error-code \ (f …))
(object \ (g …)))
(print-status error-code)
(print-status object))))
These functions may be defined differently for different contexts, but overloading may be neccessary, because different types of objects have to be checked, so fn-pointers won't work
(some useful usecase for this may be when using the expansion of or I suggested in another issue)
Would it not be possible to wrap the procedure definition in a namespace, and have the relevant forms (in this case get-status) be defined within that namespace, but outside of the procedure?
so I could write a macro, that uses this function. Example for some debug functions:
These functions may be defined differently for different contexts, but overloading may be neccessary, because different types of objects have to be checked, so fn-pointers won't work
(some useful usecase for this may be when using the expansion of
or
I suggested in another issue)