NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Re: A Language for People Who Like to Type (Score:2, Insightful)
You should spend more time working with staticly typed languages. It would be a "very bad thing" for a staticly typed language to inherit a constructor (you'd have a nasty case of memory corruption). If you think that is odd, you should take C++ for a spin. Member functions are not virutal by default. Or better yet, try writing OO-C sometime (no, not with glib. Take the time to actually setup the data structures required to implement virtual functions yourself). It'll give you a much better appriciaition for the power and flexibility provided by dynamic languages. In fact, here's a short example of an OO-C "class", including a simple virtual function implementation...
There you have the *minimum* quantity of declaration for a tiny class with a single virtual member function. We haven't even got around to actually *implementing* the function, yet. When you start throwing in things like interitance, and making sure you get clean, warning-free compiles even with C++ compilers, look out.
Add to that the strict method signature checking, the requirement that constructors have the same name as the class, and you could find yourself (as in the first example in this article) declaring several constructors that meticulously gather arguments and call super() with them.
This is "normal" for the vast majority of programmers. In fact, pretty much anyone with a CS degree will spend the vast majority of their undregraduate years working with staticly typed languages. To them, the fact that Perl allows (and encourages) the inheritance of constructors is a bizzare thing. I 100% agree that for the vast majority of programming tasks, raw speed and/or memory efficiency is such a non-issue that it makes a lot of sense to take advantage of the expressive power provided by dynamic languages. However, there are still a large number of tasks that really need to sit closer to the hardware so that developers can squeeze more performance (e.g., video encoding, decoding, device drivers, many embedded systems). This is why I think Inline::C is so damned cool. It allows people to easily write performance critical portions of applications in C, but make use of the expressive power of Perl for the remaining 90%. Gosling forbid a language should reduce busywork.
This I agree with. Java has all of the performance overhead of a dynamic language, and virtually none of the benefit.
Reply to This
Re: A Language for People Who Like to Type (Score:1)
Is this because of memory allocation or method dispatch or something else I'm missing? I realize that allocation in C++ is tricky, but that's so rarely a concern in Java...
Re: A Language for People Who Like to Type (Score:2, Insightful)
The compiler keeps track of a base address and offset of class members (e.g., the struct/class starts at address 0xDEADBEEF and the m_udder member has an offset of 6 bytes). In static languages, the comp