[r6rs-discuss] [Formal] SRFI-39 should be made an R6RS library
On Sun, 11 Feb 2007, John Cowan wrote:
> OT: I've noticed a tendency in Scheme libraries to eschew global value
> definitions for functions that return a constant value. Has anyone
> else noticed this (I can't point to evidence offhand), and does anyone
> know why?
It makes the call site use a function call instead of a variable reference.
That means that when you're making changes later, you can change the *way*
something is defined (using a function) instead of just the definition
(using a value). For example, you may initially implement a program that
updates the display every 0.2 seconds, and then later decide that you want
to update the display less often (or not at all) when being run as a shell
script and more often when being run at a user interaction window.
If you defined the update-frequency as a variable, then you can change its
value across the program by changing a constant in the source. But if you
defined it as a function, then you can change the *WAY* it's computed (ie,
check to see if the program is running in batch mode) by changing a function
in the source.
Bear
Received on Mon Feb 12 2007 - 13:55:46 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC