🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #5

Re: Reflective extensions (was Re: Why functional languages?)

#5
From: Richard Brooksby
Date: Tue, 27 Oct 1992 13:05
43 lines
1869 bytes
werts@aardvark.cecs.csulb.edu (Michael Werts) wrote:

> I have never heard of "mu abstractions" before. Would somemone
> please post a short description?

As far as I understand it, a mu abstraction is to declarations as a
lambda abstraction is to values (expressions).  Consider this
hypothetical code:

  let
    val x = 1;
    mu (fn context => Context.add_value_binding (context, "y", 3))
  in
    x+y
  end

==> 4

The body of the mu is a piece of code which modifies the environment
by adding a binding of the symbol "y" to 3.

Clearly, the body of the mu must be executed during the _compilation_
of this code fragment, and thus mu abstractions provide a way to
escape upwards by one `level' into the compilation.  (There is no good
reason not to nest them, by the way.)

These things allow language extensions such as `import', to include
the result of compiling another file of declarations:

  fun import context source =
    <<stuff to add declarations from `source'>>

  let
    mu import "foo"
  in
    <<stuff using declarations from source `foo'>>   
  end

This is a bit wooly, I'm afraid.  I hope you get the idea.
---
Richard Brooksby <richard@harlqn.co.uk>
ML Project / Symbolic Processing Division / Harlequin
+44 223 872522 ext 50
Technical Details
Message-ID: <RICHARD.92Oct27130549@ml.harlqn.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!harlqn.co.uk!harlqn!richard
References: <RICHARD.92Oct21123440@ml.harlqn.co.uk> <BwHGF7.71t@beach.csulb.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.functional
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!harlqn.co.uk!harlqn!richard
From: richard@harlqn.co.uk (Richard Brooksby)
Subject: Re: Reflective extensions (was Re: Why functional languages?)
In-Reply-To: werts@aardvark.cecs.csulb.edu's message of 21 Oct 92 17:54:43 GMT
Message-ID: <RICHARD.92Oct27130549@ml.harlqn.co.uk>
Lines: 43
Sender: news@harlqn.co.uk (Usenet News Account)
Organization: Harlequin Limited, Cambridge, England
References: <RICHARD.92Oct21123440@ml.harlqn.co.uk> <BwHGF7.71t@beach.csulb.edu>
Date: Tue, 27 Oct 1992 13:05:49 GMT