[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Diversity - existence, value, and pursuit.

> Date: Sat, 1 Dec 2001 03:48:59 -0500 (EST)
> From: Shriram Krishnamurthi <sk@cs.brown.edu>
> Michael Vanier wrote:
> > best:  After an initial period of confusion, a few "canonical" syntaxes
> >        develop which are each adopted by a large pool of users (e.g. scheme
> >        syntax, pythonish syntax, c-ish, etc.).  All can be translated into
> >        each other, and the syntaxes all are translated into some base
> >        representation (e.g. S-expressions).  Projects can even mix modules
> >        using different syntaxes, since the underlying semantics are the
> >        same.
> I believe the Scheme 48 module system permitted something like this.
> Last year, Robby Findler added some hooks to DrScheme, and Paul
> Fernhout wrote an indentation-based reader for Scheme.  He even got
> some help from DrScheme's source correlating error reporting subsystem
> to display errors.  This code likely hasn't been ported to DrScheme
> v200, but I imagine that it wouldn't take much work to write something
> like this.  I think these examples he posted are all legal fragments
> he could handle (looks like there's some missing lib code, though):
> ----------
> define
>  foo x 
>  let
>   (y 10) (z 20) 
>   print (* x y z) 
[long example deleted]

This is very nice.  If you could do this in arbitrary ways in DrScheme e.g.

;; infixy syntax, sort of like python
define foo(x)
  let y = 10, z = 20
  print x * y * z

then I think you'd be staggered at how popular DrScheme would become.  I
don't think people really have a problem with scheme's semantics, just with
the syntax and with the mostly-functional programming model that is natural
in scheme (which is a whole other issue).

I could even imagine a course set up whereby students first learn a
"familiar" infix syntax to get them started, and later learn how to go
"under the hood" and work with S-expressions.  Some of these students would
probably become converted to S-expression syntax as their primary vehicle
of (programmatic) expression.

Both ocaml and rebol have elements of this already.  Ocaml has camlp4,
which allows user-definable syntax (but isn't trivial to learn, hence it's
really for experts, which may be a good thing).  Rebol (which is much like
scheme, as readers of this list know) has its dialects.  I'm not sure how
much they're used in practice; maybe the rebolers can say something about

I think guile scheme took the wrong approach of saying they would generate
_translators_ from other languages to guile.  The problem with this is that
you not only have to support the other language's syntax, but also its
semantics, even when the semantics are broken (e.g. python's non-support of
closures until recently).  If you stick to syntax, this doesn't come up.