When I try to compile my new code (big part is cell template), I get an error stating "procedure too big". It points to a loop that is repeated for every section exactly the same way -- the curious thing is that the loop in question is not the first one in code. Removing the "wrong" line out of the loop just makes the compiler point to the next line. If I comment out the whole loop, the error points to the next loop. All this makes me think that something other than syntax is wrong.
Any ideas?
Procedure error
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Procedure error
hoc's parser complains if a procedure contains too many lines of code. This is one
aspect of hoc that could reasonably be called "a feature, not a bug" because it
discourages the use of giant procedures, which are hard to develop and maintain.
However, for this minor limitation of hoc to be a truly effective "feature," the parser
should really issue its complaint much sooner than it does.
The generic workaround is to split the offending proc into a bunch of smaller procs,
and call them individually. In your particular case, I suspect there is an even better
approach: if in fact your giant proc consists of a sequence of loops that are "repeated
for every section exactly the same way," why not use a forall statement? Or if you
only want to deal with a select group of sections, put them in a SectionList, then
use a forsec statement?
aspect of hoc that could reasonably be called "a feature, not a bug" because it
discourages the use of giant procedures, which are hard to develop and maintain.
However, for this minor limitation of hoc to be a truly effective "feature," the parser
should really issue its complaint much sooner than it does.
The generic workaround is to split the offending proc into a bunch of smaller procs,
and call them individually. In your particular case, I suspect there is an even better
approach: if in fact your giant proc consists of a sequence of loops that are "repeated
for every section exactly the same way," why not use a forall statement? Or if you
only want to deal with a select group of sections, put them in a SectionList, then
use a forsec statement?