neuronsimulator/nrn

HOC template with `public morphology`.

Closed this issue · 1 comments

1uc commented

Consider the following HOC template found in the channel benchmark (interesting parts only):

begintemplate CA1_int_bAC_011017HP2_2018011015390
  public morphology
endtemplate CA1_int_bAC_011017HP2_2018011015390

https://github.com/BlueBrain/nmodlbench/blob/af3852f2880d35c0b352132c040d3de9e537cd71/benchmark/channels/lib/hoclib/CA1_int_bAC_011017HP2_2018011015390.hoc

As far as we (@alkino and me) can tell the following two statements are true:

  1. There exists a HOC symbol called "morphology" which is used to refer to the morphology.
  2. This template creates a different symbol called morphology.

Why do we notice? When generating code with NOCMODL, it does hoc_lookup("morphology") during registration and saves the symbol in a static variable. In NMODL, we do the hoc_lookup("morphology") when allocating the property. When using the above HOC template the NMODL generated code will pick up the wrong symbol, i.e. the one created by the template.

Question: Are HOC templates permitted to have a public morphology?

1uc commented

This is fine. It's likely a scoping issue that could be circumvented using hoc_table_lookup cause a lookup in the appropriate symbol table.