Function declarations ?

Gregory Ewing greg.ewing at canterbury.ac.nz
Mon Jun 13 21:18:18 EDT 2011


Steven D'Aprano wrote:

> "Hoisting" in computing refers to the idea of "lifting" variables or code 
> outside of one block into another.

I'm not sure it's the right term for what's happening here,
though. Nothing is being lifted to a higher level -- the
functions remain at the same level they were written at.

> Here's another model: Pascal. Because Pascal does type checking at 
> compile time, it will reject the function ham() and raise a compiler 
> error,

It's more that Pascal is designed to make single-pass
compilation easy. It's possible to support out-of-order
declarations with compile-time type checking using two
passes; Pyrex does this, for example.

-- 
Greg



More information about the Python-list mailing list