Since R7RS,
cond-expand has the library clause, which checks if the library specified in the clause exists or not. If you are handling multiple implementations, this feature is useful, for example, if one of the implementations doesn't support SRFI-1, then you can write a compatible layer easily. However, if there's a new procedure and/or macro added in a new version of Sagittarius, this library clause doesn't work as I want. To resolve this dilemma, I've added the new version clause to cond-expand.The
version clause can be used to cooperate among Sagittarius versions. The below example shows how to split the process between 0.9.12 and earlier.(import (rnrs)
(sagittarius) ;; for cond-expand
(sagittarius crypto keys))
(cond-expand
((and cond-expand.version (version (>= "0.9.12")))
;; secp160r1 is supported since 0.9.12
(generate-key-pair *key:ecdsa*
:ec-parameter *ec-parameter:secp160r1*))
(else
;; default ECDSA key pair for earlier version
(generate-key-pair *key:ecdsa*)))
The cond-expand.version is required to make it work on Sagittarius version earlier than 0.9.12.I personally think this feature should be incorporated into R7RS but I'm too lazy to write a SRFI.
No comments:
Post a Comment