I stand corrected, especially for C++, but I still think of them being more OO than C or Perl. From: everything is an object in Python : "This is so important that I'm going to repeat it in case you missed it the first few times: everything in Python is an object. Strings are objects. Lists are objects. Functions are objects. Even modules are objects. "
| [reply] |
# Perl
sub get_name {
my ($self) = @_;
return $self->{name};
}
# Python
def get_name(self):
return self.name
| [reply] [d/l] |
Given the timing of the two -- python coming out in 91 -- it just wasn't that popular yet to have had a strong influence... but C++ has the same paradigm --
passing 'this' as the first param on the stack... Yet, how else would one do it where objects can have variable params. Is there a language that does it differently?
While I hadn't heard of python back in 91, I was using perl4. Perl5 came out in 94, 3 years later. While it could have been influenced by python, what other paradigm is there? I'd see both python and perl having derived such from C++, but maybe you were part of the design team and know something more from personal history? C++ had been around since the early-mid 80's and was already fairly well known and used (I'd used it, but integrating obj paradigms is still an ongoing work for me). So it seemed a more logical influence. Given perl's roots, I didn't give lisp much credit even though perl is closer to lisp than python...
If perl came from python, I'm surprised perl's obj system is so much more flexible (as others have compared it to lisp). I'll bet that lisp passed the "this" object
as the first list param as well...(?)...
| [reply] |
Pythonistas like to claim having a multi-paradigm language and right in the next phrase they'll tell you that there shouldn't be more than one way to do it.
Perl for instance is far closer to LISP, lambdas (anonymous subs) are not restricted to one statement and Perl's my is provides a declaration like LISP's let lacking in Ruby, Python and to some extent even in JS.
I had the privilege to see a presentation of a Python module which was a port from Ruby, and it's almost ridiculous to see how they try to circumvent the limitations of their syntax to be able to reflect real lamdas ("code-blocks" in Ruby).
Cheers Rolf
( addicted to the Perl Programming Language)
| [reply] [d/l] [select] |
| [reply] |
| [reply] |