Given for example a build command that do this:
(define-command (build-command arguments)
((invoke "build"))
(parameterize ((current-c-toolchain #%?CC))
(require ...)))
This command will parameterize the current C toolchain for compiling <c-binary> with the value of the variable CC. However, that variable could be not defined in the blueprint configuration at all. But it can also be defined dynamically by the user by doing ./configure CC=gcc. Thus, it is entirely possible for a variable to maybe defined.
Currently, trying to lookup a state variable that is not defined will raise an exception. And so the current way of handling this is to do:
(define-command (build-command arguments)
((invoke "build"))
(parameterize ((current-c-toolchain (or (false-if-exception #%?CC) "gcc")))
(require ...)))
I think it could be interesting to have a way to specify a default value instead of raising an exception. For example, we could do #%?CC|"gcc"|. So now, either the variable CC is defined and its value is returned, or the string "gcc" is returned.
Thus one could do:
(define-command (build-command arguments)
((invoke "build"))
(parameterize ((current-c-toolchain #%?CC|"gcc"|))
(require ...)))
Thoughts?
Given for example a build command that do this:
```scheme
(define-command (build-command arguments)
((invoke "build"))
(parameterize ((current-c-toolchain #%?CC))
(require ...)))
```
This command will parameterize the current C toolchain for compiling `<c-binary>` with the value of the variable `CC`. However, that variable could be not defined in the blueprint configuration at all. But it can also be defined dynamically by the user by doing `./configure CC=gcc`. Thus, it is entirely possible for a variable to **maybe** defined.
Currently, trying to lookup a state variable that is not defined will raise an exception. And so the current way of handling this is to do:
```scheme
(define-command (build-command arguments)
((invoke "build"))
(parameterize ((current-c-toolchain (or (false-if-exception #%?CC) "gcc")))
(require ...)))
```
I think it could be interesting to have a way to specify a default value instead of raising an exception. For example, we could do `#%?CC|"gcc"|`. So now, either the variable `CC` is defined and its value is returned, or the string `"gcc"` is returned.
Thus one could do:
```scheme
(define-command (build-command arguments)
((invoke "build"))
(parameterize ((current-c-toolchain #%?CC|"gcc"|))
(require ...)))
```
Thoughts?