From: Norman Werner
Subject: fill-pointer/compilation question
Date: 
Message-ID: <87u17fd01j.fsf@wh6-307.st.uni-magdeburg.de>
Hello,

I do create an vector with a fill pointer and everything is fine.

(setq *test* (make-array 0 :element-type 'list :fill-pointer t :adjustable t))
=> #()
(array-has-fill-pointer-p *test*)
=> T

But after compiling a file with: (setq user::*test* '#.user::*test*) 
to save this vector in a file and loading this file again to restore
the vector

(array-has-fill-pointer-p *test*)
=> NIL

And of course this results in errors later on.


Is it me or is it the implementation  doing wrong? Is it possible to
attach a fill-pointer to a vector after creation (I didn't found
anything)? I don't rely on fill-pointers - I think I can make the code
working without. But anyway this puzzles me.


Norman
-- 
One Language to rule them all, One Language to find them, One Language
to bring them all and in the darkness bind them in the Land of Mordor
where the Shadows lie.  

Norman Werner (Zi. 307)
J. G. Nathusius Ring 7 (WH6)
39106 Magdeburg
·············@student.uni-magdeburg.de

From: Kalle Olavi Niemitalo
Subject: Re: fill-pointer/compilation question
Date: 
Message-ID: <87vfrv62jz.fsf@Astalo.kon.iki.fi>
Norman Werner <·············@student.uni-magdeburg.de> writes:

> But after compiling a file with: (setq user::*test* 
> '#.user::*test*) to save this vector in a file and loading this 
> file again to restore the vector
>
> (array-has-fill-pointer-p *test*)
> => NIL

The file compiler is permitted to remove fill pointers from 
arrays.  See CLHS sections 3.2.4.2.2 and 3.2.4.4.

Perhaps you could instead construct the vector at load time, with 
something like:

  (setq user::*test*
        (make-array '#.(array-dimensions user::*test*)
                    :initial-contents '#.user::*test*
                    :fill-pointer '#.(fill-pointer user::*test*)))

This code itself is not portable, because the file compiler can 
also truncate the array at the fill pointer and then it won't have 
enough elements for :initial-contents.
From: Norman Werner
Subject: Re: fill-pointer/compilation question
Date: 
Message-ID: <87smmze0xe.fsf@wh6-307.st.uni-magdeburg.de>
Kalle Olavi Niemitalo <···@iki.fi> skribis:

> Norman Werner <·············@student.uni-magdeburg.de> writes:
>
>> But after compiling a file with: (setq user::*test* '#.user::*test*)
>> to save this vector in a file and loading this file again to restore
>> the vector
>>
>> (array-has-fill-pointer-p *test*)
>> => NIL
>
> The file compiler is permitted to remove fill pointers from arrays.
> See CLHS sections 3.2.4.2.2 and 3.2.4.4.>
> Perhaps you could instead construct the vector at load time, with
> something like:
>   (setq user::*test*
>         (make-array '#.(array-dimensions user::*test*)
>                     :initial-contents '#.user::*test*
>                     :fill-pointer '#.(fill-pointer user::*test*)))>
> This code itself is not portable, because the file compiler can also
> truncate the array at the fill pointer and then it won't have enough
> elements for :initial-contents.

Thanks for the clarification. 
I had afterwards a hard but fair argument with my
clhs and I think we can still be friends.

This:
 (setq user::*test  
     (make-array
        '#.(fill-pointer user::*test*)
         :adjustable t
         :fill-pointer t
         :initial-contents '#.user::*test*))

Now _seems_ to work.


Norman
-- 
One Language to rule them all, One Language to find them, One Language
to bring them all and in the darkness bind them in the Land of Mordor
where the Shadows lie.  

Norman Werner (Zi. 307)
J. G. Nathusius Ring 7 (WH6)
39106 Magdeburg
·············@student.uni-magdeburg.de