bug-make
[Top][All Lists]
Advanced

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

Re: 'withfile' function implementation


From: Tim Murphy
Subject: Re: 'withfile' function implementation
Date: Fri, 16 Dec 2011 12:41:12 +0000

Just a quick comment on this.

I looked at the implementation and it seems like a different name
would suit this function - e.g. "writefile".  It basically writes text
from it's arguments out to a file.

The idea of a function called "withfile" seems hard to actually
implement - I'm not sure how one might even do it.  It would be like a
special kind of $(eval), I think.  The output file would be open while
the contents were being evaluated and closed when they finished.
Within this evaluation, any calls to $(write filehandle,xxxx) would
happen to the file.  I think this is a pretty hard thing to do and
although I love the (to me) elegance of it, it's a bit harder to
implement and the function you have provided is more than good enough
for the situations that I've needed so far.

I think that a "withfile" would come into it's own when you  could put
it around a giant makefile:
$(withffile fh,"log.out",
include hugemakefile.mk
)

Since you would open and close the file only once rather than
repeatedly and this might be a good thing for parse speed.
But I suspect that this form could have performance, memory etc
implications that might be undesirable because of the need to load and
store a complete copy of the makefile in memory and then evaluate it.

Perhaps I will get a chance to submit some actual code one day when I
can sort out open source contributions with my employer.

In the meantime:

$(writefile "filename",value)
$(appendfile "filename",value)

would probably be quite nice and they don't absolutely demand that one
use the C library mode flags (w,w+,a etc). This is one thing that
Paul didn't like from the previous suggestions.

Regards,

Tim

On 15 December 2011 23:13, Lawrence Ibarria <address@hidden> wrote:
> This is a rather simple path that implements a very simplified version of
> what Tim suggested in his message of Sept 25th
> (https://lists.gnu.org/archive/html/bug-make/2011-09/msg00044.html ).
>
>
>
> Paul, what do you think? I’d rather not try to do everything, just focus on
> one thing. I am not sure how much safety checks play a role inside make.
>
>
>
>   -- Lawrence
>
>
>
> ________________________________
> This email message is for the sole use of the intended recipient(s) and may
> contain confidential information.  Any unauthorized review, use, disclosure
> or distribution is prohibited.  If you are not the intended recipient,
> please contact the sender by reply email and destroy all copies of the
> original message.
> ________________________________



-- 
You could help some brave and decent people to have access to
uncensored news by making a donation at:

http://www.thezimbabwean.co.uk/friends/



reply via email to

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