Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] about Obj.magic
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-31 (18:22)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] about Obj.magic
An 'almost legal' use of Obj.magic is to populate an array with dummy 
For example:

    class Deep  ..
    let a = Array.make 100  (Obj.magic 0 :> Deep) in
    let len_a = ref 0 in

This is roughly as safe as an unsafe array access,
only now the array length is a variable.

John Max Skaller,
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: