#Store parsed value of a UUID via pointer

4 messages · Page 1 of 1 (latest)

safe pawn
#

the main reason that the JSON package does this is that it doesn't know at compile time what (JSON) type the JSON will be; it could be an object, number, string, etc. there's just no way other than returning an any to have a return type fit all that, so they take in a pointer and make it a runtime error if the type of the variable you passed in doesn't match the parsed type. here, that restriction doesn't exist

#

forcing the caller to have a preexisting variable for no discernable reason isn't a great pattern. i know that you said it fits your particular calling pattern here, but that's only one instance where it might be used

#

you can avoid the whole two-variable situation with a var err error, then use =

#

(if there weren't already an error variable existing in the function)