Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000459OCamlOCaml generalpublic2001-07-30 12:472001-08-08 05:31
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000459: typage des objets
DescriptionFull_Name: Virgile Prevosto
Version: 3.01+1 (2001-04-19)
OS: RedHat 6.2
Submission from: etna.lip6.fr (132.227.83.203)


ocamlc plante sur le fichier suivant, au moment de la definition de Try2_.obj:

class virtual[ 't ] setoid =
object(sobj:'self)
  method different (x:'t) (y:'t)= not (sobj#equal x y )
  method virtual element: 't
  method virtual equal: ('t)->('t)->bool
end;;

class [ 't , 'a, 'spec_a ] foo2((a):('spec_a))=
object(sobj:'self)
  constraint 'spec_a= ( 'a)#setoid
  constraint 't = bool
  inherit [ 't ]setoid
  method equal= (=)
  method element= false
  method my_foo= 2
end;;

class [ 't , 'f, 'spec_f ] bla((f):('spec_f))=
object(sobj:'self)
  constraint 'spec_f= 'self -> ('f, 't, 'self)#foo2
  constraint 't = int
  inherit [ 't ]setoid
  method printb (a:'t)= string_of_int a
  val mutable my_spec=None
  method my_spec = match my_spec with
    None -> failwith "not initialized"
   | Some s -> s
  method element= (sobj#my_spec)#my_foo
  method equal= (=)
  initializer
    my_spec <- Some (f (sobj))
end;;

module Try2_ =
struct
  type f_t = bool
  type fspec = stype -> (bool,rep,stype) foo2
  and rep = int
  and stype = (rep, f_t,fspec)bla
  let obj = (new bla(fun f ->new foo2(f)) :>stype)
  end
;;

Le message obtenu ne facilite pas la recherche de l'erreur:
Uncaught exception: File "typing/ctype.ml", line 0, characters 71629-71641:
Assertion failed

A priori, le probleme se trouve dans la resolution des contraintes de types: si
on definit

class type [ 't , 'f, 'spec_f ,'argt_f,'f_a] blatype =
object ('self)
  constraint 'spec_f= 'argt_f -> ('f, 'f_a, 'argt_f)foo2
  constraint 'argt_f = 'f_a #setoid
  constraint 't = int
  inherit [ 't ]setoid
   
  method printb: ('t)->string
  method my_spec: (bool, 't, 'self)foo2
  method element: 't
  method equal: ('t)->('t)->bool
end

avec deux parametres de types supplementaires (qu'on retrouve aussi dans la
definition de bla), et que Try2_.stype prend la forme
(...)blatype, la compilation s'effectue sans probleme, et les objets crees ont
le type (et le comportement) attendu.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000625)
administrator (administrator)
2001-08-08 05:31

Ce probleme est deja` corrige' dans la version 3.02.
En fait, la construction des sous-types a` change'. Voir tutoriel: 3.10, using
coercions.

Cordialement,

Jacques Garrigue
(0000626)
administrator (administrator)
2001-08-08 05:31

Fixed in 3.02. JG.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker