Why do you need more than the base implementations for clever, nicely built systems?
How many millions of bugs are in thousands of programs written in C because C has null-terminated strings? By storing the length of the string with the string itself, Perl renders an entire category of bugs and security problems and O(n) (or worse) algorithms irrelevant.
| [reply] [d/l] |
To expand on chromatic's comment, you can actually have strings with embedded \0's and it all "Just Works". Without me having to worry about anything.
This goes back to one of my primary rules for software development - have as few moving parts as possible that you have to maintain. This is why I use modules as much as possible, even for the simplest of things. The closer my code is to my problemspace and the fewer moving parts I have to maintain, the better off I am. So, whenever I have to worry about the flag that says "My string ends here", that's an extra moving part. Whenever I have to worry "Did I free everything correctly?", that's an extra moving part. And, so on.
So, no, I don't believe that Perl-written-as-C is more powerful. In fact, Perl-written-as-Perl is much more powerful than C can ever be, from a developer perspective. Of course, hand-tuned C is going to be faster, smaller, and all that jazz. But, frankly, it's cheaper, from the business's perspective, to buy another machine than pay me for a week of my time. So, that's a non-starter.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] |
Believe me friends, if you know C and write your Perl as the same, you'll find the real power therein.
(Almost) every time I see some Perl code written in the style of C, that code
- uses non-idiomatic looping structures, and
- copies too much data around, and
- doesn't take advantage of language features (like regexps) which are written in C.
On the other hand, having some knowledge of the way perl's internals are written in C can give you some insights into optimisation and behaviour.
Simply asserting that one will "find the real power therein" when they "know C and write your Perl as the same" is retarded thinking.
P.S. -- is Java clumbsy? Rhetorically.
P.S. Were you drunk when you posted this drivel ?
-David
| [reply] |
So is your argument addressed to the language or its programmers? That is, are you saying Perl the language allows to much complexity, or that programmers are best off only using the most basic features of the language? | [reply] |
When you want to get to the corner store, how long does it take you to slay the dinosaur? For then you must bury it, wait for it to turn into oil, pump the oil out of the ground and start-up the refinery while you build a fire to start smelting that chunk of rusty rock you just dug up...
No, that's not what you do. You plop your buns into that nice pre-built car, drive down to the store to go to the freezer-section to grab that nice pre-built pizza in a box, muttering “well, it will just have to do” as you wander over towards the beer.
So, build computer-programs that way, using the highest-level tools you can find. Because what you want to do is to “cease feeling hungry and cease feeling sober.” Or to have a working program that solves whatever your client next needs to do, so that you can enjoy your box-pizza and beer without having to push-through three hours of coding work with either a faint buzz or a big hangover. Does a high-level programming tool that does most of the work for you, or better-yet a CPAN module that does all of the work for you, sound appealing? Sure.
Laziness. Hubris. Warm pizza. Cold beer. Life is good.™
| [reply] |