Ruby and Python

Suchandra Thapa ssthapa at harper.uchicago.edu
Tue Nov 21 03:26:47 EST 2000


graham <graham73 at telocity.com> wrote:
>
>By this definition C has first class functions. Sure you have
>the minor inconvenience of having to take pointers to functions,
>and using dereferencing to call them. But that's a minor point.
>So does C have first class functions?

    You are missing the point that C does not allow you to 
dynamically create new functions at runtime.  You can create
new data types using a malloc but you can only use function pointers 
to manipulate functions that exist at compile time.  This creates
a clear distinction between say an integer that which you create new
instances of at runtime and functions which can only be created at
compile time. Thus, functions don't have the same rights assigned to 
them as data types and are second class in comparision.  If there
is no distinction between data and functions, functions are first 
class.
    The only major quibble you can really have about python's handling
of functions is that runtime creation of objects are limited by 
the restrictions on the lambda function.  However, you can get
around this by chaining a bunch of lambdas together.


-- 
------------------------------------------------------------------
			    |
Suchandra Thapa             | "There are only two kinds of math books. 
s-thapaNO at SPAMuchicago.edu  | Those you cannot read beyond the first 
			    | sentence, and those you cannot read 
			    | beyond the first page."
			    |                       -C.N. Yang
------------------------------------------------------------------



More information about the Python-list mailing list