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

'The virtual method cannot become concrete'

Expand Messages
  • ethan_aubin
    (** Hi, Can anyone explain the meaning of the error message: The class type object method virtual tagged : [ ] end is not matched by the class type [_[ ]]
    Message 1 of 1 , Jul 2, 2005
    • 0 Attachment
      (**
      Hi, Can anyone explain the meaning of the error message:

      The class type object method virtual tagged : [> ] end
      is not matched by the class type [_[> ]] element_type
      The virtual method tagged cannot become concrete

      What does the _ before [> ] indicate? The method in element type is 'a
      where 'a = [> ]. Any nudges toward enlightenment appreciated --
      ethan.aubin@...


      Code and error message follow: *)

      class type ['a] element_type =
      object
      constraint 'a = [> ]
      method tagged: 'a
      end

      class virtual ['a] element: ['a] element_type =
      object (self)
      constraint 'a = [> ]
      method virtual tagged : 'a
      end

      (** I'd like to do something like: *)
      class type ['a] box_type =
      object
      constraint 'a = [> `Box of 'a box_type]
      inherit ['a] element_type
      method lbs: int
      end

      class ['a] box =
      object (self)
      inherit ['a] element
      method lbs = 5
      method tagged = `Box(self :> 'a box_type)
      end



      (* The above fails printing:

      ocamlc -i -dtypes -g -c delme.ml
      File "delme.ml", line 8, characters 2-77:
      The class type object method virtual tagged : [> ] end
      is not matched by the class type [_[> ]] element_type
      The virtual method tagged cannot become concrete
      *)
    Your message has been successfully submitted and would be delivered to recipients shortly.