Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typage des objets #2870

Closed
vicuna opened this issue Jul 30, 2001 · 2 comments
Closed

typage des objets #2870

vicuna opened this issue Jul 30, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 30, 2001

Original bug ID: 459
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_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.

@vicuna
Copy link
Author

vicuna commented Aug 8, 2001

Comment author: administrator

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

@vicuna
Copy link
Author

vicuna commented Aug 8, 2001

Comment author: administrator

Fixed in 3.02. JG.

@vicuna vicuna closed this as completed Aug 8, 2001
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant