[plt-scheme] Re: to define, or to let

From: Bradd W. Szonye (bradd+plt at szonye.com)
Date: Wed Apr 21 00:57:39 EDT 2004

Bradd wrote:
>> I only wish that more people saw the wisdom in having separate,
>> explicit constructs for ordered evaluation, unordered (but
>> non-concurrent) evaluation, and potentially-concurrent evaluation.

Bill Richter wrote:
> Brad & Anton, I think I figured it out: you're good C++ programmers,
> and willing to live with something MF won't: unenforceable contracts.

I'd phrase that differently. Programmers make design decisions that
compilers can't enforce (because they're undecidable, or they require
domain knowledge). Still, I like the ability to encode those decisions
in software. Comments get stale, but code doesn't, so a reviewer or a
maintainer can always trust that a coded contract reflects the intent of
the programmer. Also, in some cases, programmer assertions can enable
optimizations that the compiler couldn't possibly decide on its own.

> Seems I've read MF complaining about C++ stuff that sounds good, but
> the compiler doesn't enforce it.  Classes maybe.  You declare things
> to be "private", but you can "peek" if you want.

Eh? You can't peek inside a class unless you break the rules of C++ or
play tricks with raw memory access. It's really no different from
"peeking" inside a Scheme abstract data type implemented with lists and
vectors: You can use a lower-level interface to break the high-level
abstraction.

> Am I warm?

Sort of, but you're coming at it from the wrong direction.

> Maybe unordered-let and unordered-evaluation would be good design,
> that programmers would use when they thought order didn't matter.
> Good code annotation, as Anton says.

Right. The programmer can make assertions that a compiler can't easily
infer, which allows code reviewers, maintainers, and optimizers to do
their jobs more easily.

> But I think MF would insist that Mzscheme does *not* have these
> unordered constructions until Mzscheme is smart enough to enforce it.
> And statically, that's never, right?

I don't know for certain. Possibly. I don't really care, though, so long
as Scheme gives me the constructs I want to express my design decisions.

> But Robbie's contracts.ss is enforceable, right?  If you declare a
> Robbie contract, and then break it, won't DrScheme flag that?

I don't know enough about them to say.
-- 
Bradd W. Szonye
http://www.szonye.com/bradd


Posted on the users mailing list.