Skip to content

Commit

Permalink
Fixed unique token generation in genfft
Browse files Browse the repository at this point in the history
Unique token generation was based on the assumption that OCaml compiler
won't inline a given piece of code. Starting from 4.02.0 it does more
aggressive inlining and breaks this functionality.
  • Loading branch information
artemkin committed Jan 20, 2016
1 parent 119aa4c commit f8a7359
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions genfft/unique.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@

(* repository of unique tokens *)

type unique = Unique of unit
type unique = int

(* this depends on the compiler not being too smart *)
let make () =
let make_aux x = Unique x in
make_aux ()

(* note that the obvious definition
let id = ref 0

let make () = Unique ()
let make () =
id := !id + 1;
!id

fails *)
let same a b =
a = b

let same (a : unique) (b : unique) =
(a == b)

0 comments on commit f8a7359

Please sign in to comment.