4 ms·
You insinuate without providing the reasons behind it. I say this because diskhash and tie look like extremely useful things used carefully. This sort of thing
by mycelium 9y ago
You insinuate without providing the reasons behind it. I say this because diskhash and tie look like extremely useful things used carefully. This sort of thing solves exactly a problem I have right now.
> Perl tie, which is kinda considered an anti-pattern in modern Perl ... a lot of people think it should be avoided in the general case, even though it seems like a really nice simple solution to a common problem
Why? Any links to blog posts?
> When I first started reading I assumed it'd be used for small things, but he's working with a 32GB file shared across multiple processes. That's a lot of opportunity for data corruption.
I've used something similar and data corruption because of size is low on my list of concerns. If your storage layer fails in this manner silently, you have much bigger problems.
- SwellJoe 9y agoIt's not an opinion I hold strongly, it's just something I've noticed. I've seen more than one talk where someone apologized for implementing something with 'tie'. Here's one blog post about it (still opinion): http://www.skrenta.com/2007/05/tie_considered_harmful.html http://www.skrenta.com/2007/05/tie_considered_harmful.html And, this article from the Modern Perl site itself has mixed opinions on the subject, but comes down on the side of not using it, in the general case, but knowing how and when to use it can be really valuable (Tie is the last subject covered on the page): http://modernperlbooks.com/books/modern_perl_2014/11-what-to-avoid-in-perl.html http://modernperlbooks.com/books/modern_perl_2014/11-what-to... I'm not trying to say there's no place for it. Tie in Perl has been used for really cool stuff.
- mycelium 9y agoAppreciate the response and reasoning!