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
unchecked virtual method declaration #3231
Comments
Comment author: administrator From: Judicael.Courant@free.fr
Je ne sais pas vraiment ce qui est voulu. Jacques |
Comment author: administrator Le dimanche 7 Novembre 2004 03:38, Jacques Garrigue a écrit :
Un warning m'irait très bien. Et peut-être un petit mot dans la doc pour Judicaël.Judicael.Courant@ntsys.fr |
Comment author: administrator Wish granted in 3.09 (JG) |
Original bug ID: 3231
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Related to: #7107
Bug description
Full_Name: Judicaël Courant
Version: 3.08.1
OS: Linux
Submission from: ns0.ntsys.fr (81.56.176.124)
Bonjour,
Lorsqu'une méthode virtuelle est utilisée mais non déclarée, le typage ne
proteste pas :
$ ocaml
Objective Caml version 3.08.1
class virtual foo = object (self) method foo = self#bar + 0 end;;
class virtual foo :
object method private virtual bar : int method foo : int end
Ce qui n'est pas conforme à ce que laisse penser la section 3.5 "Virtual
methods" du manuel (tous les exemples déclarent les méthodes virtuelles).
Si ce comportement est voulu, peut-être faudrait-il le mettre dans la doc ?
Pour ma part, je préférerais obtenir un message d'erreur, car dans l'état
actuel, le message ne renseigne du coup pas du tout sur l'origine de l'erreur
dans le code suivant :
class virtual foo = object (self)
method foo = self#var (* typo, il fallait écrire "bar" *)+ 0
method virtual bar : int
end
class foobar = object (self) inherit foo method bar = 33 end;;
This class should be virtual
The following methods are undefined : var
Judicaël.
The text was updated successfully, but these errors were encountered: