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

Implicit Blocks considered harmful



    I don't see any motivation for having implicit blocks around functions,
    and think they should be eliminated for the following reasons:

      1) It is used very infrequently, so there is no reason to pay the overhead
         in both the interpreter and when compiling one.

I've seen this used a fair amount, and people seem to find the resulting
code very intuitive.  As for overhead, it doesn't slow down compiled
code if you don't use this mechanism.  There are many things in the
language that are less useful and that slow down the interpreter; in the
past, we've taken the attitude that this doesn't matter too much, though
I realize this is debatable.

      2) It is trivial to put one in yourself if you need it, so code that
         uses them now can easily be updated (Automatically even).
      3) It's a bad idea to begin with, since it couples the NAME of the
         function with how it operates.  Thus, if you ever change the name
         you must go through and check for any return-froms.

If you ever change the name of the function, it is trivial to check for
any return-froms (Automatically even).

      4) Most importantly, it is a problem for parallelism.  A Block cannot
         return until all of its sub-forms have returned values, since one of them
         can do a Return-From.   This is only a problem for the interpretor
         since the compiler knows if a return-from is used, but now interpreted
         code and compiled code will get different behavior.

Common Lisp was not designed to support parallelism.  Since none of us
could claim that we had a good grasp of what a parallel Lisp should look
like, we decided not to try to put in a lot of half-measures to make
various styles of parallel processing easier.  That is why, for example,
we require left-to-right order of argument evaluation instead of leaving
this unspecified.  People who want to play with parallel Lisp systems
will undoubtedly want to change Common Lisp in a variety of ways, and
eliminating the implicit block may be one of them, but until one of
these styles "takes hold", I don't think we should mess with the
standard language to accommodate people's hunches about what might
interfere with the style of parallelism they prefer.

-- Scott