Version française
Home     About     Download     Resources     Contact us    
Browse thread
Bigarray question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dbely@m...>
Subject: Re: [Caml-list] Bigarray question
Thomas Fischbacher <Thomas.Fischbacher@Physik.Uni-Muenchen.DE> writes:

>> > As far as I can see from the documentation, it is not explicitly permitted 
>> > to change a once allocated bigarray data structure in such a way that one 
>> > replaces the data pointer by some other data pointer (while retaining 
>> > size and type). This would, however, be quite useful in some situations.
>> 
>> Is your bigarray a wrapper around some externally allocated data, created
>> via alloc_bigarray() C call?
>
> It's a somewhat special case of just that situation, yes.
>
> I supposed I may just do so, however, the specification (documentation) 
> does not give me any guarantee that this is valid, so, at least the 
> documentation has to be changed before I can rely on this.

1. For the current implementation it's safe (use Data_bigarray_val(v) to
change the data pointer). I don't see any reason why it could become unsafe.
2. It is up to you whether to use this feature or not.

> There is a subtle difference between "just accidentally works"
> and "works because it is guaranteed by specification".

OCaml is a developing language, so IMHO nobody guarantees that nothing will
change in the future.

- Dmitry Bely