[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another ANSI standard question



>   I just realised that my code violates vote 36 of the new
>   ANSI standard! i.e. my code happily destroys constants that
>   appear in executable code. Unfortunalety, it seems to me,
>   to be the only way of elegantly doing things.
> 
> The question:
> 
>   What's the wall of brick waiting to fall on my head if I
>   continue with this way of doing things? Glups...

There are at least two ways you can lose.

(1) An implementation might put literal constants in read-only memory, so that 
bashing one could lead to anything from an error signaled at runtime to such 
lovely things as bad pointers, gc crashes, and so on.

(2) An implementation might merge two literal constants that are "similar as 
constants" into a single value, so that when you bash one you are at the same 
time clobbering some "apparently" unrelated value.

You didn't give very much information about the details of what you are doing, 
but it might be that LOAD-TIME-VALUE will give you the functionality you want.  
That is, instead of writing (say)
  '(A B)
you can write
  (LOAD-TIME-VALUE (LIST 'A 'B))
and happily bash away at the list returned by LOAD-TIME-VALUE.

As an aside, there is no such thing as "vote 36 of the new ANSI standard".  The 
numbering of proposals in CLtL2 is purely an artifact of that book, and its 
generally more informative to reference a proposal by name (I was able to guess 
which one you were referring to from context, but had to look it up to make 
sure).  You've probably noticed that the proposals are numbered alphabetically 
in CLtL2.  Well, since that list was compiled, X3J13 has passed a number of 
additional proposals, and they don't all have names that begin with "Z"...