david.g.johnston@xxxxxxxxx wrote:adrian.klaver@xxxxxxxxxxx wrote: Thanks, David. Re your paragraph #1, yes: that’s similar to how I’d’ve answered. I might’ve said, too, that a function is invoked as a term in an _expression_—and _expression_ evaluation is meant to be side-effect free. Following on, just like how variables are named, a function name should be a noun (phrase). Having said this, the planet has an uncountable number of “library” status functions whose names are imperative verb phrases. Many start with “get”. So this orthography battle is well and truly lost. On the other hand, folks find it fairy natural to name procedures with imperative verb phrases. Having said all this, the SQL language rather muddies the waters with its “returning” clause in a change-making statement. I s’pose that the purist would call “update… returning” a procedure with an out parameter rather than a function with a side effect. But I can be as pragmatic as the next programmer, stop fussing, and write a (volatile) function with a side effect when I think that it’s be nice. Re your paragraph #2, I already made the case for anonymous procedures. And I said that, to deserve the name, they must allow parameterization. They bring their value in a certain kind of scripting where you want to do stuff but leave no secondary traces. Plus the point about whether you even have the privilege to create objects. However, nobody here was convinced by this thinking. I do think that it’s risky to dismiss as valueless some feature that, for example, Oracle Database has (and has had since the dawn of time), and that PG lacks, unless the feature is intertwined with specific aspects of the other environment that have no counterpart in PG. The extreme example of this thinking is to dismiss the notion of PL/pgSQL packages and inner procedures as valueless except in that they might ease migrations from Oracle Database to PG. |