[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal: An OOC Package Tool
At 4:01 AM -0700 4/8/99, Dirk Muysers wrote:
>What about closures and higher order
>functions (mapcar) which are conspicuously absent in Oberon (as well as all
>other non-functional)languages?
Hanspeter Mössenböck proposed a simple block scheme for Oberon in SIGPLAN
Notices several years ago.
Back in 1995, we added support for anonymous local procedures into the
Vermillion language (which in most ways was very much like Oberon) to great
success. In particular, it allowed us to do things that in C++ one probably
would have done with stack allocated variables relying on constructors and
destructors. For example,
GPort.OffscreenDo (currentPort,
targetBounds,
BLOCK (VAR offscreenPort: GPort.Port)
offscreenPort.EraseRect (someRectangle);
offscreenPort.DrawText (someText);
END);
Not as powerful as Scheme closures since they aren't first class, but very,
very useful. It's certainly enough to support mapcar like operations:
Seq.EachDo (mySeq, BLOCK (e: Seq.Element) ... END);
They are actually useful enough that if I had it to do over again, I'd
probably look at providing some syntactic sugar to make them even easier to
construct; e.g.,
Seq.Each (mySeq) DO (e : Seq.Element)
...
END
JavaScript has closures and doesn't particularly pretend to be a functional
language.
Mark