ashinn / chibi-scheme

Official chibi-scheme repository
Other
1.23k stars 141 forks source link

Exposing the supported SRFIs trough (features) #995

Closed Retropikzel closed 3 months ago

Retropikzel commented 3 months ago

These Scheme implementations have supported SRFIs listed on the (features) list.

Would it be possible to expose them in Chibi too?

It would help when writing portable code that might depend on SRFI, but fall back on (mayber slower) portable implementation.

lassik commented 3 months ago

The R7RS idiom is:

(cond-expand
  ((library (srfi 69))
   (import (srfi 69))))

The (library (foo ...)) cond-expand requirement is new in R7RS. It is not present in SRFI 0.

Listing each SRFI separately in features makes the list quite unwieldy. Try stklos -V | grep features for a real example of this. It also isn't well defined whether SRFIs loaded from third-party libraries add themselves to features and how they would do so.

(library (foo ...)) eleagntly checks for any library that can be imported - not only built-in libraries, and not only SRFIs.

ashinn commented 3 months ago

Thanks @lassik, I agree, let's not pollute the features list when we have a perfectly usable and more portable alternative.