[plt-scheme] units and rightward drift
You can use `include' to reduce it to zero. Or, you can define a new
language to reduce it to 2:
(module foo-unit (lib "unit-lang.ss" "whereever")
(import ...)
(export ...)
(define ...))
by redefining the #%module-begin macro in the unit-lang.ss file in the
whereever collection.
Robby
At Mon, 28 Apr 2003 23:46:26 -0400, "Neil W. Van Dyke" wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> I tenaciously cling to the 79-columns rule of code formatting, so I'm
> interested in syntax for reducing rightward drift in unit definitions.
>
> Currently, I do something like this, which results in a 6-space indent
> baseline for the definitions (assuming the popular indentation convention):
>
> |(module foo-unit mzscheme
> |
> | (require (lib "unitsig.ss")
> | "foo-sig.ss")
> |
> | (define foo@
> | (unit/sig foo^
> |
> | (define (f1) ...
> +----------------------------
> |123456(
>
> If adding "define-unit/sig" syntax were appropriate, the indent baseline
> is reduced to 4, which is a precious gain:
>
> |(module foo-unit mzscheme
> |
> | (require (lib "unitsig.ss")
> | "foo-sig.ss")
> |
> | (define-unit/sig foo@ foo^
> |
> | (define (f1) ...
> +----------------------------
> |1234(
>
> I'm guessing reducing it to 2 requires special support to be added to
> the MzScheme module loader, which is unfortunate:
>
> |(module/unit/sig foo-unit mzscheme foo@ foo^
> |
> | (require (lib "unitsig.ss")
> | "foo-sig.ss")
> |
> | (define (f1) ...
> +----------------------------
> |12(
>
> I won't argue for reducing it to 0 (although it isn't entirely wacky,
> considering that the module loader seems to want exactly one "module"
> form per file, so the file constitutes a syntactic scope or extent):
>
> |(file-module/unit/sig foo-unit mzscheme foo@ foo^)
> |
> |(require (lib "unitsig.ss")
> | "foo-sig.ss")
> |
> |(define (f1) ...
> +----------------------------
>
> So... is "define-unit/sig" and/or "module/unit/sig" a good idea?
>
> --
> http://www.neilvandyke.org/
>