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

Re: why is tree-shaking hard?



In article <CONVERSE.95Mar2141828@orca.uchicago.edu> timoshenko, 
converse@cs.uchicago.edu writes:
>I understand that allowing EVAL would make tree-shaking impossible,
>(or at least "fruitless" :-) since you would not be able to predict in
>advance which portions of the language would be needed at run time.
>I'm curious what complexities have to be addressed even if you 
>rule out EVAL.

(Hi Tim.)

Not just EVAL, but also FUNCALL (and maybe APPLY).

For example, an evil programmer could write something like:

 (let* ((input (get-some-user-input))
        (function-name (read-a-fn-name input)))
   (funcall function-name))

Any possible function might be envoked.


A less evil programmer could write

  (let ((function-name (choose-function-from-assoc-list)))
    (funcall function-name . <args>))

The problem for the tree-shaker in the latter case is to realize
that the assoc-list contains names of functions that might
be executed.

I'm just making this stuff up but it seems reasonable. :-)

-- 
Tom McDougal    University of Chicago Artificial Intelligence
     mailto:mcdougal@cs.uchicago.edu 
     http://cs-www.uchicago.edu/~mcdougal
     PP-RH