[Python-Dev] Re: Inline code in other languages

Paul Prescod paulp@ActiveState.com
Thu, 23 Aug 2001 11:36:11 -0700


Lars Marius Garshol wrote:
> 
>...
> 
> Why not make it import C files, instead of putting them inline? I
> guess you very often want to reuse the C functions in several
> different places anyway, and you'd mostly want to have includes and
> stuff as well.

If you want to reuse a C function then you put it in a seperate file and
use #include to include it. Allowing inline code is a choice...the
programmer can choose to modularize if it helps him or her. I think
there is a reason PHP is so much more popular than DTML-like solutions
(duck!).

> This way you can also get rid of the MD5-ing and just use ordinary
> modification times to figure out what needs to be recompiled.

MD5-ing is more reliable anyhow. Some build systems (e.g. CONS, SCONS)
are moving from mod times to build times anyhow.

> You can't inline pieces smaller than functions anyway, and to me the
> mix between Python and C code looks very ugly.

Beauty is in the eye of the beholder....I think that forcing stuff into
separate files for aesthetic or philosophical reasons is severe.
Ultimately there is an important usability benefit in allowing inlining
(and I'll refer again to the amazing popularity of PHP).
-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook