[racket-dev] syntax/syntax proposal

From: Ryan Culpepper (ryan at cs.utah.edu)
Date: Fri Jun 15 17:09:15 EDT 2012

On 06/15/2012 01:12 PM, Asumu Takikawa wrote:
> Hi all,
>
> Recently I was using the `stx-car` function from `syntax/stx`. At some
> point, I had called it on a non-syntax pair and the error message came
> from `car`, which is used inside the implementation of `stx-car`.
>
> I thought it would be nice to add contracts in `syntax/stx` for better
> error messages, but it turns out that the contract library depends on it
> and so it's impossible to do without introducing cycles.
>
> So I would like to propose a `syntax/syntax` library with the following:
>    * provides `syntax/stx` functions with contracts attached
>      (caveat: core libraries like `racket/contract` would still use
>               `syntax/stx`)
>    * for consistency with the rest of the language,  `stx-car` and
>      friends would be renamed to use the `syntax-` prefix instead of
>      `stx-`.

-1

The 'stx-*' functions work on values that aren't syntax objects, so 
renaming them to 'syntax-*' would be misleading. Also, 'syntax->list' 
already exists and means something different from 'stx->list'.

Roughly,

   stx = syntax | null | (cons syntax stx)

--

I sometimes wonder if we should make a racket/pre-contracts 
subcollection and just stuff all of racket/contract/base's dependencies 
in there, then say everything else is allowed (maybe even expected) to 
use contracts.

Ryan

Posted on the dev mailing list.