Re: Unicode lambda Lassi Kortela 14 May 2019 14:03 UTC

> Also Racket has things like "#lang racket/base". A more general
>
>      #!(lang whatever <options...>)
>
> might make sense.

Haskell's GHC compiler supports magic comments like this:

{-# LANGUAGE ExistentialQuantification,
              FlexibleInstances,
              GeneralizedNewtypeDeriving,
              MultiParamTypeClasses,
              TypeSynonymInstances,
              DeriveDataTypeable #-}

So we could have equivalent syntax:

#!(lang haskell
         existential-quantification
         flexible-instances
         generalized-newtype-deriving
         multi-param-type-classes
         type-synonym-instances
         derive-data-typeable)

(Not saying we should aspire to support Haskell with all those
extensions :D But the general form of directive seems robust.)

Just noticed that SRFI 10 ("#, external form") from 2000 by Oleg
Kiselyov covers the same ground we are now exploring. The idea there is
to permit things like:

     #,(pi)
     #,(NaN)
     #,(os-type)
     #,(srfi-features)

The general form specified is #,(<tag> <datum>*). Clearly we are
standing on the shoulders of the same giants.

The #,(foo) form is meant to evaluate to an object so it would be
different from #!(foo) which is meant to control the reader or write
metadata that is discarded by the reader. But anyway #,(foo) is from the
time of R5RS and is not compatible with R6RS and syntax-case which uses
#,<datum> as an abbreviation of (unsyntax <datum>). R7RS-small does not
reserve #,(foo).

Per later published SRFI 108 (Named quasi-literal constructors) in 2013.
It discusses SRFI 10 and mentions that 108 evaluates its &symbol{...} at
eval time whereas SRFI 10 evaluates its #,(symbol ...) at read time. The
{...} is also a string instead of an S-expression.