Subject Re: [IB-Architect] Trigger Templates
Author Jim Starkey
At 07:35 PM 7/1/00 +0800, Joseph Alba wrote:
>I noticed that there are several triggers that have exactly the same body,
>but are for different tables.
>I would like to propose templates (like that of C++).


>Also, Triggers can be the same code for different "events" like, Before
>Update and Before Delete can share the same code.
>so, I would like to propose that multiple "events" can be included to the
>Trigger Header like

[snip again]

A couple of questions and comments.

First, do you think this stuff needs to be in the engine, or would
an extension to GDEF be sufficient? Is there really much gain
over simple cut and paste?

Second, C++ templates are kinda funny beasts, added very late in the
development cycle to paper over a specific design problem concerning
container classes. In essence, templates are compile/link time macros.
To the best of my knowledge, no other language has adopted the idea.
Wouldn't a simple macro facility answer your needs and be a great
deal more flexible to boot? I'm generally not a proponent of macros
(macros in a language is a confession by the designer that he screwed
up), but they seem a better match for your problem.

Lastly, and this may determine the choice between a template and a
macro model, what update semantics do you want. I presume that
a change to the template should force a change to all instances.
But what if one fails -- what happens?

If the answers are a) engine, b) template, and c) consistency, there
are major changes to the engine, the system tables, and the various
DDL processors, most of which will be difficult to make backwards
compatible. Do you think this is worth the cost of a little cut
and paste activity in a text editor? It seems to me likely that the
number of keystokes expended in the implementation would exceed the
number of keystrokes expended over the lifetime of the feature...


Ann and I are back from three days on the boat and one day of small
New England town Independence Day celebrations, rested, relaxed,
sharp of tooth and claw, but temporarily too mellow to use them.

Jim Starkey