vortex icon indicating copy to clipboard operation
vortex copied to clipboard

new / try_new / new_unchecked

Open gatesn opened this issue 1 year ago • 1 comments

It's misleading to have new() call try_new().unwrap() since it obscures the lack of safety.

I'd propose we have a new_unchecked and new() Result<...> where unchecked can be used as an optimisation, otherwise the caller can explicitly call new().unwrap() and therefore it's obvious that it can panic.

gatesn avatar Mar 03 '24 10:03 gatesn

Unchecked is usually used to mean unsafe, i.e. this can succeed but still be wrong. I would say we should kill the new methods and just keep try new

robert3005 avatar Mar 03 '24 11:03 robert3005

We have mostly got rid of try_new.unwrap. I think we should enforce no random unwraps

robert3005 avatar Aug 07 '24 13:08 robert3005