20322, "benharsh", "Memory.Initialization: explicitDeinit function signature", "2022-07-28T19:53:43Z"
The current signature of explicitDeinit
is:
proc explicitDeinit(ref arg: ?t)
There are some minor questions I want to raise concerning the argument name and return type.
Return Type
The return type is empty. We should change this to either t
or arg.type
:
proc explicitDeinit(ref arg) : arg.type
proc explicitDeinit(ref arg : ?t) : t
The type query currently exists to be passed into needsDeinit:
if needsDeinit(t) then
<deinit>
The type query does not currently serve much of a purpose when the function body could use args.type
just as easily. Of course, if we used it as the return type then it would be more justifiable. This is really more of a broader question regarding our standard conventions (if they exist for this case, or what they should be).
Formal Name
Perhaps this is just my personal bias, but arg
feels a little casual. In Reflection.getField
we use the name obj
and have deprecated the versions with the formal name x
. I propose we do the same here:
proc explicitDeinit(ref obj: ?t) : t