Re: [PATCH v8 4/8] env: Allow U-Boot scripts to be placed in a .env file

Tom Rini
2021-10-19T16:45:13Z

[-- Attachment #1: Type: text/plain, Size: 3050 bytes --]

On Tue, Oct 19, 2021 at 10:39:55AM -0600, Simon Glass wrote:
> Hi Tom,
>
> On Tue, 19 Oct 2021 at 10:30, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Tue, Oct 19, 2021 at 10:24:25AM -0600, Simon Glass wrote:
> > > Hi Wolfgang,
> > >
> > > On Tue, 19 Oct 2021 at 10:20, Wolfgang Denk <wd@denx.de> wrote:
> > > >
> > > > Dear Simon,
> > > >
> > > > In message <CAPnjgZ1p6ueRhDsgBZGMXFhgv7UhRFA1UfvoHGGd0-136oTgvA@mail.gmail.com> you wrote:
> > > > >
> > > > > But how do we handle this?
> > > > >
> > > > > var+=fred
> > > > >
> > > > > Is this appending to var or assigning to var+ ?
> > > >
> > > > It is assigning to "var+".
> > >
> > > er...
> > >
> > > > >
> > > > > var++=fred
> > > > >
> > > > > is unambiguous but very confusing. I think it would be better to disallow +
> > > >
> > > > It's neither unambiguous nor confusing. It is assigning to "var++".
> > >
> > > What? Can you read that again?
> >
> > With the assumption that the append operator is "=+" and NOT "+=" then
> > yes, your examples are unambiguous because = is not allowed in variable
> > names, before and after.
> >
> > > > I think we should not change what is old and might be in use.
> > > >
> > > > It is much easier to change what is new and can be defined at will.
> > > >
> > > > If we define for example that "<name>=+<value>" appends, then we can
> > > > also define our own escape rules, for example:
> > > >
> > > > var=fred assigns
> > > > var=+fred appends "fred"
> > > > var=\+fred assignes the value "+fred"
> > > > var=++fred appends "+fred"
> > >
> > > I don't like that at all. It requires an escape for a common case and
> > > is very confusing.
> >
> > Wait saying we'll add "+SOMETHING" is a common case?
>
> Yes we have places where we add to env vars depending on CONFIG settings.

Yes, but what requires escape is we want "var" to evaluate to or append
the string "+fred". Not append "fred" which is common.

> > > Since people will be converting their out-of-tree scripts anyway, they
> > > can check for this sort of madness at the time. There should be no
> > > problem.
> >
> > I'm not sure I like saying the operator is "=+" rather than "+=" because
> > "=+" is a less commonly seen operator and tends to be an alternative
> > appends for special cases / side-effects / position in parsing.
>
> Me neither. I started hearing Voltaire's admonition ringing in my head
> a few emails back.
>
> The way I have this, is it fairly trivial to convert an existing
> script to a text file. I suspect it can be done automatically but I
> have not actually tried it. I'd really like to keep it simple. I also
> want to invoke the 'if you are not in mainline you don't exist' maxim
> at this point.

I really want to see the non-trivially-constructed case where "+" is at
the end of a variable today. If we can support it in the middle, yes, I
can see how there might be example of that in use today.

--
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]