On 28.08.2014 20:37, Joe User wrote:
> On Thu, 28 Aug 2014 20:18:46 +0200, Janis Papanagnou wrote:
>
>> The awk language is not "cluttered up" (WRT new supported syntax) by
>> your proposal; it's just a function. Mind that all the time related
>> functions are anyway gawk specific (or at least non-standard), so adding
>> another function in this subdomain should not be to severe a crucial
>> problem. The only "problem" I see is that someone has to contribute it.
>> And of course that Arnold might have some reservations about it.
>
> Really, there are two problems. The specification and the implementation.
Specification and implementation are two aspekts of a change, not two
problems.
>
> It is fairly easy to change the code to add functions and language
> features to an awk implementation.
Added functions and changed language, OTOH, are two issues of different
severity and impact. (It's arguable of whether those issues merge in awk.)
>
> The hard part is to get someone to think the changes through, to make the
> language consistent and understandable, without a lot of exceptions.
I agree, for a language change that conflicts with all sorts of other
constructs and whatnot. But we were not talking about [such] a language
change[*], we were talking about a self-contained function without any
side-effects[**]. So the issue's really not that muddy as you somewhat
vaguely suggest. Ed's proposal has a narrow well defined interface that
is based on existing format specifiers.
But what part is it that you find non-consistent or non-understandable
in the proposal?
> To
> make it fast and flexible. To update documentation. To make sure the
> changes are upward compatible. To get acceptance by the user community.
> That is the hard part.
Not very concrete and many gereralities. Let me pick that apart...
"fast and flexible" - yes, but in case the first (or any) version is
not perfect you only "pay" for it if you use it. What flexibility
for the specific function are you missing from the proposal?
"update documentation" - quite trivial with the proposed function,[***]
which even relies on already existing definitions where applicable.
BTW, a function needs to be documented whether implemented natively
or through the extension mechanism.
"upward compatible" - a name clash seems to be the only potentially
incompatibility issue. Not worse than the existing strftime(), isn't
it?
"acceptance by the user community" - again, people who don't need that
function won't notice (modulo name clash if you incidentally decided
to name one of your own functions strptime(). And people who'd like
a function like that won't complain either.
That all said, and acknowledging that the set of native functions shall
be kept at a minimum, a question; shouldn't all gawk specific functions
(or even all existing function sets[****]) be supported by an extension
interface then?
The reason I am asking is; typically you have modules for extensions
that cover a specific topic, and many functions collected in a module.
If I want time stamps and time/date manipulation I could bind them,
the existing ones and the proposed addition, with a single "include".
And since you have mentioned the difficulty-of-good-design questions;
rethink about the gawk non-standard but native extensions. Have strftime
available but include strptime? Designwise, if consequent and if at all,
both might be better placed with the other time functions in a loadable
time/date module.
(But I noticed, sadly too late, that I have written more than worth the
issue.)
Janis
[*] As previously said, predefined names for function will affect the
programs insofar that you cannot use that name for other purposes, but
that's it.
[**] Some native awk functions (unfortunately) have side-effects, some
other former proposed extensions are also often proposed with similar
side-effects than the builtins (e.g. match()).
[***] WRT complexity of documentation a quick look into the gawk manual
will be enlightening; strftime() for example requires only a few lines
of documentation, and I'd expect strptime() not to require substantially
more.
[****] E.g., why bother with standard numerical functions in the core
awk code if all I do is non-numeric data processing.