[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Handling references to invalid variables
From: |
rsbecker |
Subject: |
RE: Handling references to invalid variables |
Date: |
Mon, 20 Feb 2023 14:20:39 -0500 |
On February 20, 2023 2:11 PM, Paul Smith wrote:
>In the next major release (not the upcoming 4.4.1 release but the one after
>that) I
>plan to implement notifying users of invalid variable references; for example
>variable names containing whitespace.
>
>So, a makefile like this for example:
>
> all: ; echo $(cat foo)
>
>will notify the user about the illegal variable reference "cat foo", instead
>if silently
>expanding to the empty string.
>
>My intent is that this is always enabled, not requiring an extra option like
>--warn-
>undefined-variables, since it's never legal to have a variable name containing
>whitespace.
>
>The question is, should this notification be a warning? Or should it be a
>fatal error?
>Originally I thought it should be fatal but now I'm leaning towards making it a
>warning, at least for a release or two, because I worry about makefiles that
>might
>have these references that are silently and innocuously expanding to empty
>strings,
>suddenly stop working completely.
Having worked on (insert large number) of build engines, there are likely users
who depend on bad or empty strings behaving in a particular way (prior to this
feature). I like your idea of turning this detection on by default from a
personal standpoint; however, I think you need to be able to return to a
compatible mode for some users. Having an option like
--undefined-variables=warn or --undefined-variables=error (the default) or
--undefined-variables=ignore would be prudent.
Just my $0.02
--Randall
--
Brief whoami: NonStop&UNIX developer since approximately
UNIX(421664400)
NonStop(211288444200000000)
-- In real life, I talk too much.