Re: pl/pgsql feature request: shorthand for argument and local variable references

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pl/pgsql feature request: shorthand for argument and local variable references
Date: 2022-01-06 16:10:29
Message-ID: CAFj8pRBHrBPu7ugb560UyouX4Qi84c2jXOz7mMjhvs4JyWGrDQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

čt 6. 1. 2022 v 16:59 odesílatel Joel Jacobson <joel(at)compiler(dot)org> napsal:

> On Thu, Jan 6, 2022, at 15:05, Pavel Stehule wrote:
> >>čt 6. 1. 2022 v 14:28 odesílatel Joel Jacobson <joel(at)compiler(dot)org>
> napsal:
> >>How about using the existing reserved keyword "in" followed by "." (dot)
> and then the function parameter name?
> >>
> >>This idea is based on the assumption "in." would always be a syntax
> error everywhere in both SQL and PL/pgSQL,
> >>so if we would introduce such a syntax, no existing code could be
> affected, except currently invalid code.
> >>
> >>I wouldn't mind using "in." to refer to IN/OUT/INOUT parameters and not
> only IN ones, it's a minor confusion that could be >>explained in the docs.
> >
> >You are right, in.outvar looks messy.
>
> I think you misunderstood what I meant, I suggested "in.outvar" would
> actually be OK.
>

I understand well, and I don't think it's nice.

Are there some similar features in other programming languages?

> > Moreover, maybe the SQL parser can have a problem with it.
>
> How could the SQL parser have a problem with it, if "in" is currently
> never followed by "." (dot)?
> Not an expert in the SQL parser, trying to understand why it would be a
> problem.
>

you can check it. It is true, so IN is usually followed by "(", but until
check I am not able to say if there will be an unwanted shift or collision
or not.

Regards

Pavel

>
> /Joel
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Finnerty, Jim 2022-01-06 16:20:10 Re: Add 64-bit XIDs into PostgreSQL 15
Previous Message Joel Jacobson 2022-01-06 15:58:57 Re: pl/pgsql feature request: shorthand for argument and local variable references