Final draft of R7RS – small Scheme standard
lists.scheme-reports.org
lists.scheme-reports.org
Has anyone here ever deployed to multiple runtimes? Why did you do it? I'm curious.
If you want to write a graphical program in Scheme, you must work with a particular implementation. Either one that provides a graphics library itself, or one that provides a foreign function interface, which you use to load a C graphics library. If you want your program to run on multiple implementations, then it must somehow use implementation X's FFI when running on implementation X, but use implementation Y's FFI when running on implementation Y. (Either that, or you use a uniform interface to someone's "multi-platform FFI" library, which itself will run different code depending on what implementation it's on.)
Therefore, if you hope to write multi-platform code, your code or a library you use must detect what implementation it's on, and execute different code depending. Ideally, it would even execute code that says "Sorry, don't know about this implementation's FFI" when appropriate.
Incidentally, Common Lisp provides the #+ and #- notations, which provide for code that runs conditionally on whether the implementation defines a certain symbol. And incidentally, there is a Common Lisp "Common Foreign Function Interface" library that works in exactly this way:
#-(or openmcl mcl sbcl cmu scl clisp lispworks ecl allegro cormanlisp abcl)
(error "Sorry, this Lisp is not yet supported. Patches welcome!")
...
(#+openmcl (:file "cffi-openmcl")
#+mcl (:file "cffi-mcl")
#+sbcl (:file "cffi-sbcl")
#+cmu (:file "cffi-cmucl")
#+scl (:file "cffi-scl")
#+clisp (:file "cffi-clisp")
--cffi.asd
As it happens, a new item in R7RS-small is "cond-expand", which is equivalent to #+ and #-. Implementations will probably provide their own names as a feature. Thus, you could write multiple-platform FFI code that looked something like this... (cond-expand
(chicken load-foreign-library)
(racket get-ffi-lib)
...)
So, as of now, it would be possible for someone to write a multi-platform Scheme FFI library, which would use standard features of R7RS to select the correct interfaces to foreign libraries on supported Scheme implementations, and would gracefully error out on unsupported R7RS Scheme implementations. Then you could use this to write R7RS code that did graphical stuff and would work on multiple implementations. I don't know of anyone who has done this so far. (There are multiple-platform graphics programs written in Common Lisp that use CFFI; they can generally be installed with Quicklisp. This appears to show proof of concept.)From what I understand R7RS small is aimed at being closer to R5RS while avoiding the controversial things introduced by R6RS.
But what about R7RS large? What are the overall aims of that? Has that been decided yet?
And frankly, I dont see what the point will be: R7 small is not much differrent than R5, so it is kind of pointless. R7 big is as big as common lisp, and very few implementations will have the resources and the willingness to implement it and discard their current non-standard APIs they had for years. And even if the majority of them manages to implement R7, they will finally reach the point where Common LIsp was 1994, with no added value over Common Lisp, provided of course they dont decide to obsolete R7 also and get to R8 before that.
The point of R7 is to make it is easy for implementation to upgrade from R5 after the controversial R6.
Ideally, most of the libraries in R7-big will be able to be written mostly in R7-small. If they are smart, they'll make a R7-big FFI library, and then every other library can be written in R7 + C.
This means an implementation would only need to implement R7-small and would get all the libraries of R7-big for free.
There is also the much more robust Chibi Scheme that implements all of R7RS.
Does "final draft" mean this is the official R7RS-small standard, does it mean this is the final text being sent to the steering committee for endorsement, or does it mean something else entirely?
I think that is correct. The Working Group had put up draft 9 for public vote, which (narrowly) made the 85% ratification requirement set by their charter. There was a final objection made by Gerald Jay Sussman, whose opinion carries a lot of weight when it comes to Scheme... The WG voted unanimously for a change that addressed his concerns, and the Steering Committee approved the making of this change, after which we had this tenth draft. I do believe the WG is done with it. Therefore it seems basically set in stone, unless the Steering Committee edits it, which seems to me outside the scope of what they do (although I don't feel I completely understand how this works).
There are also various fairly minor changes, such as giving "log" an optional second argument (being the base of the logarithm), requiring "write" to handle circular data structures, adding "when" and "unless" macros, and adding some utilities like "file-exists?", "delete-file", "get-environment-variable", and "command-line".