[gambit-list] ##car ##cdr ##null?

Mikael mikael.trash at gmail.com
Fri Jun 11 08:59:51 EDT 2010


2010/6/11 Álvaro Castro-Castilla <alvaro.castro.castilla at 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 at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20100611/011bd924/attachment.htm>


More information about the Gambit-list mailing list