On Wed, 28 Jul 2021 19:33:54 +0000 Oodler 577 via perl5-porters <perl5-porters@perl.org> wrote: > I'm still left to wonder that if, "defer" and "finally" are so similar > and in fact tied to a similar mechanism underneath; do they need to be > called different things - or is there an opportunity to simply go with > one or the other? One could equally wonder why we'd need both `if` and `unless`, or both `while` and `until`. Many language concepts can be expressed in terms of others. It's OK to have more than one similar way to express certain ideas. People can pick whatever is the most convenient at the time. Some situations will call for try/finally, other situations will call for defer. Already right now there's loads of code using things like Scope::Guard that can be neatened up to using defer instead, without needing to consider try/finally. I think in a language as diverse as Perl, there is scope for both [pardon the pun]. -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/Thread Previous | Thread Next