Comment

Comment by saberworks

I'm not convinced that your example is more readable than a typical program in perl5 without all the magic. To read this code you have to know that appending '.IO.words' to a string will magically cause the file name referenced in the string to be read and then split into words. I would find it much more readable to just say: open the file, loop over the lines, split them into words. Maybe it's one of those conventions I'd get used to over time but right now it just leaves me scratching my head. What if dict.txt doesn't exist? What if it's there but unreadable? What if it's there but a directory? Where is the error checking? Is this going to crash or throw an exception if an error occurs? How does it determine what a word is? I can't even find it in the IO documentation (https://docs.perl6.org/type/IO). So yeah, it's nifty, sort of. It seems more like a snippet to show how nifty itself is rather than something useful.
parent saberworks 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton