Re: [I|S]CONST/[I|S]const in gram.y

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [I|S]CONST/[I|S]const in gram.y
Date: 2008-11-11 12:06:10
Message-ID: 20081111120610.GC22087@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 10, 2008 at 01:41:23PM -0500, Tom Lane wrote:
> I experimented with doing this and found that things seemed noticeably
> uglier; for example in createdb_opt_item we have (ignoring the actions)
>
> | TEMPLATE opt_equal name
> | TEMPLATE opt_equal DEFAULT
> | ENCODING opt_equal Sconst
> | ENCODING opt_equal Iconst
> | ENCODING opt_equal DEFAULT
> | COLLATE opt_equal Sconst
> | COLLATE opt_equal DEFAULT
>
> which'd become
>
> | TEMPLATE opt_equal name
> | TEMPLATE opt_equal DEFAULT
> | ENCODING opt_equal SCONST
> | ENCODING opt_equal ICONST
> | ENCODING opt_equal DEFAULT
> | COLLATE opt_equal SCONST
> | COLLATE opt_equal DEFAULT
>
> which at least to me seems confusing --- the ICONST and SCONST
> occurrences look like literal keywords rather than token classes.
> So I find I have a mild preference for the mixed-case spelling.

Fine with me too. Actually I don't think we'll waste a lot of cpu cycles when
keeping the Iconst/Sconst rules as they are.

> One possible way to shave the cycles and still have it look nice
> is to rename the actual tokens produced by scan.l to Iconst and Sconst;
> but this might be more trouble than it's worth. Thoughts?

I agree that this is not worth it. After all the mixed-case spelling looks like
a non-terminal and at some point people will spend time looking to the rules
defining these non-terminals.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2008-11-11 12:30:14 Re: pg_upgrade project status
Previous Message Sergey Konoplev 2008-11-11 12:02:13 Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)