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

Devoir de vacances #2898

Closed
vicuna opened this issue Aug 9, 2001 · 2 comments
Closed

Devoir de vacances #2898

vicuna opened this issue Aug 9, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Aug 9, 2001

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

Bug description

Bonjour,

un petit problème de confusion de nom de types assez surprenant:
si une structure porte le même nom qu'une classe dans un module M,
on peut utiliser l'un pour l'autre à l'extérieur du module:

beige[100]% uname -a
Linux beige 2.4.4 #1 Mon Jul 2 15:47:59 CEST 2001 i686 unknown
beige[101]% ocaml
Objective Caml version 3.02

module M = struct

type t = { x : int }
class t = object method x = 1 end
end;;
module M : sig type t = { x : int; } class t : object method x : int end end

open M;;

let s (y : t) = y.x;;

val s : M.t -> int =

s (new t);;

  • : int = 537745108

let o (y : t) = y#x;;

val o : M.t -> int =

o { x = 666 };;

Segmentation fault

Étonnant, non ?

--Pascal

@vicuna
Copy link
Author

vicuna commented Aug 13, 2001

Comment author: administrator

Bonjour Pascal,

un petit problème de confusion de nom de types assez surprenant:
si une structure porte le même nom qu'une classe dans un module M,
on peut utiliser l'un pour l'autre à l'extérieur du module:

En effet, il manquait une vérification d'unicité comparable à celle
que l'on fait pour les noms de types, de modules, et de types de
modules. C'est corrigé. Merci pour le rapport d'erreur.

  • Xavier

@vicuna
Copy link
Author

vicuna commented Aug 13, 2001

Comment author: administrator

Fixed 2001-08-13 by XL.

@vicuna vicuna closed this as completed Aug 13, 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