2010/6/11 Álvaro Castro-Castilla <alvaro.castro.castilla@gmail.com>
Hi,

I can see sometimes these kind of procedures ##car, ##cdr, ##null? etc... in code that has been optimized for Gambit. What is exactly the difference between those and the standard ones?

(declare (safe))
(car x) ; Argument typechecking made
(##car x) ; No argument typechecking made

(declare (not safe))
(##car x) ; No argument typechecking made
(car x) ; No argument typechecking made
 
And if these ones are faster, why are they defined as separate functions instead of just substituting the standard ones when in (unsafe) compilation?

Substitution is made automatically on (not safe) compilation.
 
Then, how are they really used?

The purpose of ##:s may be to explicitly declare unsafe use of a procedure, as the programmer is 100% sure the passed type is always correct. A hypothethical example would be (define (cdr-nice pair) (and (pair? pair) (##cdr pair))) .
 
Thanks a lot,

Álvaro

Mikael
 


_______________________________________________
Gambit-list mailing list
Gambit-list@iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list