Some thinkage about file operations

I had a quick idea today that involved a certain number of file operations and I wondered how well I could implement arithmetic operations on files using C++ operators. Sometimes it's really fun to tinker around with stuff like that if it'll never really weigh down the program at all, but looking at how all this would be realizable with just using operators, it made click and I realized that this is exactly how I'd have to define it using my own scripting language design. However, it's still interesting to think about just mapping file operations to C++ operators. Compound operators operate on the files themselves and normal operators will create temporary files using tmpfile in the stdio lib. Interesting, isn't it? I mean after all you often need to seperate files or just need a temporary one to do stuff. Maybe some day I'll convert all my C stuff that can be easily realized using classes and templates to C++ and utiize operators on everything. I'm having quite fun imagining the face of my lecturers to demonstrate how easily I can outmatch their lengthy image processing program with just a few lines of cleverly constructed matrix and file operations. Bwahaha, that must be absolutely genius to then also have the guts to make an assignment out of it. But I guess I'll never to so since I know quite a bunch of disadvantages occuring by doin so. Well, atleast it would make a lot of stuff more compact to read and write.

No comments: