An extension template cannot change the procedure's %Prototype; how to enforce the parameters it needs

Applies to: posted in the softvelocity.clarion.templates group in 2015; the thread names no Clarion version. An extension template on an existing procedure template.

Problem

An extension template needed to set the procedure's prototype and parameters. In #CONTEXT(%Procedure), #SET(%Parameters,'(Stringtheory pX)') worked, but #SET(%Prototype,'(Stringtheory pX)') did not: %Prototype is read only. The template reference says #PROTOTYPE can be used only from a #PROCEDURE template and only if one has not been used already, so an extension had no way to force it.

Solution

  1. Do not try to set %Prototype from an extension. One answerer did not know a way; another believed it is a read-only built-in symbol.
  2. Check the prototype instead, in the extension's #ATSTART embed, and raise an error:
#IF(Instring('stringtheory',LOWER(%Prototype),1,1) = 0
  #ERROR(%Procedure & ': MyTemplate needs "Stringtheory" parameter - see MyTemplate documentation')
#ENDIF
  1. Make the message name both the procedure and the template causing it, and point to the help that explains the fix. A bare "incorrect prototype" text says little.

Caveats

  • The error then tells the user to fix the prototype by hand; the template does not do it.
  • One poster said the new IDE of that time lists #ERROR text in its error window.
  • The poster called the #ERROR route reasonable; nobody tried another way.

Today (2026)

Likely unchanged, as %Prototype is a symbol the IDE owns; not re-tested on a current build.

Sources: Kevin D. (Apr 2015, the question), Arnor B. (Apr 2015), Mike H. (Apr 2015) in softvelocity.clarion.templates.