Обсуждение: a word-choice question

Поиск
Список
Период
Сортировка

a word-choice question

От
Chapman Flack
Дата:
In PL/Java's function annotations, 'type' has been used for the
volatility category:


@Function(type=IMMUTABLE)
public static String hello() { return "Hello, world!"; }


It seems a bit infelicitous because you would probably sooner guess that
'type' was telling you something about the function's _data_ type (and
indeed there are times when PL/Java can't infer the SQL data type and you
need to say it in the annotation, which has to be done with a different,
less obvious keyword because 'type' has been used for the volatility
category).  :(

It has been that way since the first inchoate commits of annotation code
eleven years ago, but I don't think it was ever usably complete until
2013. That's since the most recent numbered PL/Java release (there
hasn't been one since 1.4.3 in 2011), so it is possible to say there
hasn't yet been a numbered release featuring the code annotations.

So I am thinking there may never be a better time to change those keywords,
if they are worth changing, so 'type' would be for the function return type,
and some other word for the volatility category. At this stage, a change
might inconvenience some people who have been building from the github head
the last couple of years, but it couldn't affect anyone else.

One obvious choice for that word would be 'volatility' - after all,
'volatility category' is the term used in the PostgreSQL manual.  But
it's long, and five syllables to say, and the goofy redundancy in an
annotation like (volatility=VOLATILE) makes me snicker the same way
I can't help when I type 'set log_error_verbosity to verbose'.

Argh, verbose verbosity AND volatile volatility.

But I've been trying think of something short, clear, preferably
monosyllabic, less geeky than 'v8y', and I don't have a winner yet.
I've flirted with 'hoist', from thinking about the kind of optimization
the category is there to control ...

hoist=STABLE    hoist=IMMUTABLE    hoist=VOLATILE

meh ...

effect=STABLE   effect=IMMUTABLE   effect=VOLATILE

...

Is anyone thinking of an obvious, perfect short word for that thing
that is just eluding me at the moment? I'm starting to warm to 'effect'.

-Chap



Re: a word-choice question

От
Tom Lane
Дата:
Chapman Flack <chap@anastigmatix.net> writes:
> In PL/Java's function annotations, 'type' has been used for the
> volatility category:
> @Function(type=IMMUTABLE)
> public static String hello() { return "Hello, world!"; }
> It seems a bit infelicitous because you would probably sooner guess that
> 'type' was telling you something about the function's _data_ type

Yeah ...

> But I've been trying think of something short, clear, preferably
> monosyllabic, less geeky than 'v8y', and I don't have a winner yet.

Instead of thinking about "volatility", maybe something based on
"stability" or "constancy"?  I suppose "const" is too much of a conflict,
but "stable=IMMUTABLE" doesn't seem awful.
        regards, tom lane



Re: a word-choice question

От
Andrew Dunstan
Дата:

On 12/06/2015 11:03 AM, Tom Lane wrote:
> Chapman Flack <chap@anastigmatix.net> writes:
>> In PL/Java's function annotations, 'type' has been used for the
>> volatility category:
>> @Function(type=IMMUTABLE)
>> public static String hello() { return "Hello, world!"; }
>> It seems a bit infelicitous because you would probably sooner guess that
>> 'type' was telling you something about the function's _data_ type
> Yeah ...
>
>> But I've been trying think of something short, clear, preferably
>> monosyllabic, less geeky than 'v8y', and I don't have a winner yet.
> Instead of thinking about "volatility", maybe something based on
> "stability" or "constancy"?  I suppose "const" is too much of a conflict,
> but "stable=IMMUTABLE" doesn't seem awful.
>
>             


I would stick with "volatility". It makes for consistency - pg_proc has 
"provolatile" for example. I think it's a moderately well understood 
term in the Postgres world.

cheers

andrew