From: "David E. Wheeler" on
On Nov 15, 2009, at 10:54 AM, Greg Stark wrote:

> I'm japh too -- but that doesn't mean grabbing one little aesthetic
> from Perl without copying the whole concept behind it makes any sense.
> Perl sigils are an important part of the language and are a basic part
> of the syntax. They aren't just a "this is a variable" marker.
> Dropping one use of them into a language that doesn't use them
> anywhere else just makes the language into a mishmash.

Well, no, just because we're talking about adopting $var doesn't mean we're trying to turn SQL or PL/pgSQL into Perl. It means that we want to signify that a token is a variable, as opposed to something else (hence “sigil”). That doesn't make it a mishmash unless you think you suddenly have Perl (or shell) semantics, which would be a pretty weird expectation.

> I don't see any purpose to using such markers anyways. We have a
> parser, we have a symbol table, we should use them; these identifiers
> are just like other identifiers.

See the discussion of conflicts with column names in the recent thread. A sigil would eliminate that problem -- and we already have $1 and friends, so this is just an extension of that in my view.

Best,

David
--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Pavel Stehule on
2009/11/15 Greg Stark <gsstark(a)mit.edu>:
> On Sun, Nov 15, 2009 at 6:42 PM, Pavel Stehule <pavel.stehule(a)gmail.com> wrote:
>>> Personally, I like $var, but @var would be okay, and @@var is acceptable. But I'm JAPH, so my biases should be obvious.
>>
>> @var or @@var should be a break for people from MySQL. @var are r/w in
>> MySQL and @@var are global in T-SQL. So people could be confused.
>
> Besides, do we think MySQL and T-SQL are the heights of good language design?
>

sure no. But same arguments against to :var should be used to @var.
pgscript use it. I don't know the best semantic. But I am not happy
from this proposals. I don't see any consistency.

Pavel


>
> --
> greg
>

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Andrew Chernow on

>> I like the special marker idea. A '$' would be nice because its already in
>> use for similar purposes, but I think that would lead to ambiguity with
>> dollar quoting.
>
> no, it should be safe (if you don't use for dollar quoting some like
> $variablename$)
>

Actually, I was thinking of something like $abc$def, where abc and def are
variables. Although, this is much less likely than column name conflicts.

Other possibles are: $(var), @var@, or %var%. I'd perfer a single character
marker but that may not fly.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Pavel Stehule on
2009/11/15 Andrew Chernow <ac(a)esilo.com>:
>
>>> I like the special marker idea.  A '$' would be nice because its already
>>> in
>>> use for similar purposes, but I think that would lead to ambiguity with
>>> dollar quoting.
>>
>> no, it should be safe (if you don't use for dollar quoting some like
>> $variablename$)
>>
>
> Actually, I was thinking of something like $abc$def, where abc and def are
> variables.  Although, this is much less likely than column name conflicts.
>
> Other possibles are: $(var), @var@, or %var%.  I'd perfer a single character
> marker but that may not fly.
>

single character is my preference too.

Pavel
> --
> Andrew Chernow
> eSilo, LLC
> every bit counts
> http://www.esilo.com/
>

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Greg Stark on
On Sun, Nov 15, 2009 at 6:26 PM, David E. Wheeler <david(a)kineticode.com> wrote:
>> Moreover you would still have conflicts possible because sql can quote
>> identifiers so people can have columns named "$foo". You would have a
>> weird syntactic detail where "$foo" would mean something different
>> than $foo even though they're both valid identifiers.
>
> Same with Foo and "Foo", no?

No, that's not the same.

The point is that $ is a perfectly valid SQL identifier character and
$foo is a perfectly valid identifier. You can always quote any
identifier (yes, after case smashing) so you would expect if $foo is a
valid identifier then "$foo" would refer to the same identifier.
You're introducing a meaning for $foo but saying there's no valid way
to quote the identifier to get the same thing. And worse, if you do
quote it you get something else entirely different.

--
greg

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers