You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1064 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Jacek Chrzaszcz
Version: 3.04
OS: Linux
Submission from: fw-gw-atm.mimuw.edu.pl (193.0.96.15)
Hello,
One of my first-year student found this bug during a "TP" session:
If you have your own qinterface file map.cmi in your current directory and then
start ocaml and (forgetting about #load "map.cmo") try to use your module, like
Objective Caml version 3.04
let a=Map.empty_map in Map.update a 7 "a";;
you get a Segmentation fault
I would guess the toplevel finds the interface in the current directory and the
implementation in memory (stdlib) and ....they do not match...
I do not suppose Set or List modules would behave any better, but I include
map.mli below just in case.
Jacek Chrzaszcz
PS. I remember I found a similar bug a while ago. It is fixed/43
PS2. I hope you don't mind the comments in Polish below. The guy who wrote it is
a good student. He writes a lot of comments :)
---------cut----------
type ('a, 'b) map;;
(* mapa ma dwa typy abstrakcyjne:
'a - typ wspolrzednej
'b - typ przechowywanych danych *)
val empty_map: ('a, 'b) map;;
(* [empty_map] daje pusta mape *)
val dom: ('a, 'b) map -> 'a -> bool;;
(* [dom m x] odpowiada na pytanie "czy do mapy [m] byl wkladany element o
wspolrzednych [x] ?" *)
val apply: ('a, 'b) map -> 'a -> 'b;;
(* [apply m x] zwraca dane przechowywane w mapie [m] na wspolrzednych [x].
Jesli element o tych wspolrzednych nie istnieje, podnosi wyjatek
Not_found *)
val update: ('a, 'b) map -> 'a -> 'b -> ('a, 'b) map;;
(* [update m x d] wstawia do mapy [m] dane [d] w miejscu o wspolrzednych
[x]. Jesli w miejscu [x] jest juz przechowywany jakis element, to
zostanie
on zamieniony na [d]. Zwraca tak zmodyfikowana mape. *)
The text was updated successfully, but these errors were encountered:
Original bug ID: 1064
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Jacek Chrzaszcz
Version: 3.04
OS: Linux
Submission from: fw-gw-atm.mimuw.edu.pl (193.0.96.15)
Hello,
One of my first-year student found this bug during a "TP" session:
If you have your own qinterface file map.cmi in your current directory and then
start ocaml and (forgetting about #load "map.cmo") try to use your module, like
let a=Map.empty_map in Map.update a 7 "a";;
I would guess the toplevel finds the interface in the current directory and the
implementation in memory (stdlib) and ....they do not match...
I do not suppose Set or List modules would behave any better, but I include
map.mli below just in case.
Jacek Chrzaszcz
PS. I remember I found a similar bug a while ago. It is fixed/43
PS2. I hope you don't mind the comments in Polish below. The guy who wrote it is
a good student. He writes a lot of comments :)
---------cut----------
type ('a, 'b) map;;
(* mapa ma dwa typy abstrakcyjne:
'a - typ wspolrzednej
'b - typ przechowywanych danych *)
val empty_map: ('a, 'b) map;;
(* [empty_map] daje pusta mape *)
val dom: ('a, 'b) map -> 'a -> bool;;
(* [dom m x] odpowiada na pytanie "czy do mapy [m] byl wkladany element o
wspolrzednych [x] ?" *)
val apply: ('a, 'b) map -> 'a -> 'b;;
(* [apply m x] zwraca dane przechowywane w mapie [m] na wspolrzednych [x].
Jesli element o tych wspolrzednych nie istnieje, podnosi wyjatek
Not_found *)
val update: ('a, 'b) map -> 'a -> 'b -> ('a, 'b) map;;
(* [update m x d] wstawia do mapy [m] dane [d] w miejscu o wspolrzednych
[x]. Jesli w miejscu [x] jest juz przechowywany jakis element, to
zostanie
on zamieniony na [d]. Zwraca tak zmodyfikowana mape. *)
The text was updated successfully, but these errors were encountered: