The main problem I'm having is that the code has been around awhile and hasn't been fully converted to Racket - in particular it uses the scheme language (instead of the racket language) and uses (require (lib contract)). All of that seems to mean that I can't just add #:flat? #t - I get a message that vector-of doesn't accept keyword arguments. And, the case-> contracts use ->r, which apparently isn't supported anymore. All that means that I can't just switch to the racket language and new contracts. So, I have some conversion work to do.<br>
<br>On the case-> problem, it seems it no longer supports anything but ->. Is there something I am missing there?<br><br>Doug<br><br><div class="gmail_quote">On Sun, Oct 24, 2010 at 8:53 AM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">At Fri, 22 Oct 2010 21:31:43 -0600, Doug Williams wrote:<br>
> Matthew, would it make more sense to have unsafe-vector-ref (and related<br>
> functions) be the more general function and unsafe-vector*-ref be the one<br>
> that doesn't work on chaperoned vectors? That is just swap the definitions.<br>
> That way user code that is already using unsafe-vector-ref (etc) will<br>
> continue to work.<br>
><br>
> As it stands, existing code that has unsafe-vector-ref (etc) will often<br>
> still work (in the sense of not getting any error or crashing), but just<br>
> gives the wrong results. For example, if you run science-test.ss from the<br>
> examples directory in the science collection, there are no errors. But, some<br>
> of the answers are wrong - for example the very first one, the gamma<br>
> function. [In other cases, like the FFT routines, there are either run-time<br>
> errors or crashes.]<br>
><br>
> Anyway, if it isn't too late, I think swapping the definitions would make<br>
> more sense and be safer.<br>
<br>
</div>I've gone back and forth. I agree that it would be safer, but<br>
`vector-ref' is safer still, and I think of the job of `unsafe-X' as<br>
providing the lowest possible overhead over `X'. It seems nicer to me<br>
to have `*' mean "somewhere in between" rather than "even faster". Then<br>
again, it seems bad that `vector?' (plus index bounds) isn't enough to<br>
guard `unsafe-vector-ref'.<br>
<br>
Overall, at this point in the release cycle, I'm inclined to leave<br>
things where they are (i.e., it may be too late). But let's hear more<br>
opinions from those who use `unsafe-vector-ref' and<br>
unsafe-vector*-ref'.<br>
<br>
</blockquote></div><br>