Loading ...
Sorry, an error occurred while loading the content.
 

Re: "ocaml_beginners"::[] Intro/Examples to functional objects?

Expand Messages
  • Stalkern 2
    ... Oh no, don t worry! Functional objects should be those of a class providing some methods being a partial application of the method of a superclass
    Message 1 of 7 , Jan 28, 2005
      Micha wrote:
      > Am Freitag, 28. Januar 2005 18:51 schrieb Stalkern 2:
      > > class integerAdaptationClass () =
      > >
      > > object (self)
      > >
      > > val mutable funoftheday = (fun (i:int) -> ())
      > >
      > > method set_fun f =
      > > funoftheday <- f
      > > method get_fun =
      > > funoftheday
      > > end
      > > ;;
      > >
      >
      > I thought a functional object is an object in which some construct like
      > {< ... >} returns a copy of self, with maybe some changed instance variables.
      > This seems to be a rather normal object with a mutable function-pointer
      > inside. Maybe I've overseen something?
      >

      Oh no, don't worry!
      Functional objects should be those of a class providing some methods
      being a partial application of the method of a superclass inherited -
      but since I've never used them, I could not give an example.
      So, I was rather taking the opportunity to highlight a little
      possibility provided by functional style in objects, because it happened
      to me to find this a very powerful issue in everyday work - e.g. when
      you have a complex GUI or some cross dependencies make your Makefile
      hard to set up, or the requirements for your job change suddenly and you
      need a quick fix... things that happen when working.

      Ernesto
    Your message has been successfully submitted and would be delivered to recipients shortly.
    »
    «