chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] always use temporary filenames in csc


From: Felix
Subject: Re: [Chicken-hackers] [PATCH] always use temporary filenames in csc
Date: Sat, 10 Nov 2012 13:11:01 +0100 (CET)

> On Fri, Nov 09, 2012 at 09:02:09PM +0100, Peter Bex wrote:
>> Personally, I think there's no shame in expecting the user to know that
>> Chicken will overwrite the .c file in the current working directory
>> with the same basename as the .scm file.  "cc" will also clobber a file
>> called "a.out"; if you happen to have one by that name, tough luck.
> 
> Having said that, a cleaner way to avoid clobbering user files would
> be like CVS: detect that the file exists, and if you think it isn't
> yours, bomb.

We can do this at least for the files given on the command line.

> 
> Chicken always writes a comment to the C file.  If the first line
> for the C file that you're about to generate which corresponds to
> foo.scm doesn't match "/* Generated from foo.scm by the CHICKEN compiler",
> csc could abort with a message stating that there's a
> non-Chicken-generated file in the way.  I think this would solve Alan's
> original problem neatly and require a minimal change in Chicken's
> behavior.

I don't think this is a good idea. Scanning files for comments is
always a maintenance problem (what if the comment changes? what if the
comment happens to look like a generated one? Someone might have
cat(1)ed files together). It's a hack, I'm sure you agree with me
here.


cheers,
felix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]