OOP / language design question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carl Banks

    #31
    Re: OOP / language design question


    Lawrence D'Oliveiro wrote:[color=blue]
    > In article <1145969107.837 185.212970@e56g 2000cwe.googleg roups.com>,
    > "Carl Banks" <invalidemail@a erojockey.com> wrote:
    >[color=green]
    > >bruno at modulix wrote:[color=darkred]
    > >> cctv.star@gmail .com wrote:
    > >> > I was wondering, why you always have to remember to call bases'
    > >> > constructors
    > >>
    > >> <pedantic>
    > >> s/constructors/__init__/
    > >>
    > >> the __init__() method is *not* the constructor. Object's instanciation
    > >> is a two-stage process: __new__() is called first, then __init__().
    > >> </pedantic>[/color]
    > >
    > >You know, Python's __init__ has almost the same semantics as C++
    > >constructors (they both initialize something that's already been
    > >allocated in memory, and neither can return a substitute object). I
    > >actually think constructors are misnamed in C++, they should be called
    > >initializers (and destructors finalizers).[/color]
    >
    > "Constructo r" is also the term used for the corresponding method in Java.
    >
    > Is there any OO language that does not use "constructo r" in this sense?
    > I don't think there is one. This is standard OO terminology.[/color]

    Python?

    Yeah, I realize it's common terminology, but I just think it's a poor
    name. That Python doesn't really call __init__ a constructor is good
    (I guess it doesn't really call it anything but __init__), because
    constructor would be a bad name for it.


    Carl Banks

    Comment

    • bruno at modulix

      #32
      Re: OOP / language design question

      Lawrence D'Oliveiro wrote:[color=blue]
      > In article <1145969107.837 185.212970@e56g 2000cwe.googleg roups.com>,
      > "Carl Banks" <invalidemail@a erojockey.com> wrote:
      >
      >[color=green]
      >>bruno at modulix wrote:
      >>[color=darkred]
      >>>cctv.star@gm ail.com wrote:
      >>>
      >>>>I was wondering, why you always have to remember to call bases'
      >>>>constructor s
      >>>
      >>><pedantic>
      >>>s/constructors/__init__/
      >>>
      >>>the __init__() method is *not* the constructor. Object's instanciation
      >>>is a two-stage process: __new__() is called first, then __init__().
      >>></pedantic>[/color]
      >>
      >>You know, Python's __init__ has almost the same semantics as C++
      >>constructor s (they both initialize something that's already been
      >>allocated in memory, and neither can return a substitute object). I
      >>actually think constructors are misnamed in C++, they should be called
      >>initializer s (and destructors finalizers).[/color]
      >
      >
      > "Constructo r" is also the term used for the corresponding method in Java.
      >
      > Is there any OO language that does not use "constructo r" in this sense?[/color]

      Smalltalk. Just like Python, it has constructor *and* initializer.
      [color=blue]
      > I don't think there is one. This is standard OO terminology.[/color]

      Being "standard" doesn't imply it's accurate.

      --
      bruno desthuilliers
      python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
      p in 'onurb@xiludom. gro'.split('@')])"

      Comment

      Working...