[r6rs-discuss] thinko in spec of fxcopy-bit-field

From: Abdulaziz Ghuloum <aghuloum>
Date: Thu, 27 Sep 2007 19:31:25 -0400

On Sep 27, 2007, at 5:06 PM, William D Clinger wrote:

> Why, pray tell, must the third argument to fxcopy-bit-field
> be less than (fixnum-width)?

So that your code would still work when you do
(declare unsafe non-r6rs full-speed-forward)
and without the compiler coercing the value of
the shift to some small value. This also forces
implementors to implement these operations in a
portable, predictable, reliable, and safe manner.


> I understand that the implementation in the 5.97 draft would
> raise an exception without that restriction, but all that
> proves is that the weaknesses and restrictions of the 5.97
> draft make it unnecessarily difficult to program in this
> new language we call Scheme.

I personally prefer the "weakness" over the behavior
found in other languages, such as the following text:

===== C99 on bitwise shift operators
If the value of the right operand is negative or is
greater than or equal to the width of the promoted
left operand, the behavior is undefined.

===== Larceny on fxlsh
If the shift count exceeds the number of bits in the
machine's word size, then the results are machine-
dependent.


Aziz,,,
Received on Thu Sep 27 2007 - 19:31:25 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC