Some thoughts on the 'reveal' operator

Dean Tribble tribble@netcom.com
Tue, 28 Sep 1999 16:32:23 -0700


--=====================_1214885292==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 02:12 PM 9/28/99 -0700, Douglas Crockford wrote:
> > >  def multiplier run(a,b) reveals c {
> > >      c := a * b
> > >  }
> > >
> > >This syntax handles "reveals" sort of like Java handles "throws". And it
> >
> > I'll have to give this suggestion more serious thought, but my immediate
> > gut reaction is that I like it a *lot*.
>
>In this formulation, how is "reveals" different than "returns"?

I generally like it because we couldn't come up with anything better for 
Joule (see my first message on the subject, which crossed these in the 
pipe).  As Doug mentions, it's not clear *for E* whether the assignment is 
better than simply requiring and explicit return from functions:

def multiplier run(a,b) {
     return a * b
}

A couple of points inspired by Joule experience:
    * the compiler *must* check that it is used exactly once in every 
control-flow branch.
    * in Joule, "c" would be a Distributor, which can then be passed as an 
argument.  What is the E type of "c", and can it be used as a regular value?
    * using a variable rather than return makes multiple return values very 
clear.
    * being able to pass the Distributor to a procedure makes tail-call 
optimization explicit and easy.
    * being able to pass the Distributor to a procedure makes the first 
note very difficult:  you might not pass it where it gets used for 
returning values.

--=====================_1214885292==_.ALT
Content-Type: text/html; charset="us-ascii"

At 02:12 PM 9/28/99 -0700, Douglas Crockford wrote:
> >  def multiplier run(a,b) reveals c {
> >      c := a * b
> >  }
> >
> >This syntax handles "reveals" sort of like Java handles "throws". And it
>
> I'll have to give this suggestion more serious thought, but my immediate
> gut reaction is that I like it a *lot*.

In this formulation, how is "reveals" different than "returns"?

I generally like it because we couldn't come up with anything better for Joule (see my first message on the subject, which crossed these in the pipe).  As Doug mentions, it's not clear *for E* whether the assignment is better than simply requiring and explicit return from functions:

def multiplier run(a,b) {
    return a * b
}

A couple of points inspired by Joule experience: --=====================_1214885292==_.ALT--