Hi,

I've been playing with JHP recently. While it does well what it
originally attempts to do, I'd like to extend and generalize its use.
I want to use it for general templating.

The first step could be letting JHP return a result string. However,
the code isn't particularly designed for extension. (I have to copy
and modify the code directly)

  template=: 'hello Mr./Mrs. <%= name %>'
  name=:'Jane'
  hrep template
print 'hello Mr./Mrs. '
print  name
  0!:0 hrep template   NB. since this session is from J window print
is smoutput
hello Mr./Mrs.
Jane

What I want is a verb v that does:

  'hello Mr./Mr.s Jane' -: v template

I could modify the code directly myself, but that doesn't seem like a
proper way of extending a code. Code should be closed for modification
but open for extension[1].

Obviously, next step would be handing over a key, value pairs(maybe
the name of a locale that contains those variables) to the templating
verb.


[1] Open-Closed principle http://www.objectmentor.com/resources/articles/ocp.pdf
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to