In my inp file I have
if nelem(C)==0 # if no checking for time-variability of
# # coefficients required, do estimation
# # (nelem(C)>0 activates Monte-Carlo Mode)
Upon compilation to a function package I get in the gfn file:
if nelem(C)==0
# # coefficients required, do estimation
# # (nelem(C)>0 activates Monte-Carlo Mode)
That is, a comment is dropped. This may make it difficult to understand the comment.
Cheers
Ekkehart
Diff:
Similarily,
turns after compilation into
I have not been aware of that and shall adjust my way of commenting. But maybe it would be nice allow for comments after commands.
I see, however,that this is not a bug but rather a feature!
Cheers
Ekkehart
Not sure this is a feature instead of a bug. I believe it is actually a recent change that comments are preserved at all in the gfn, and so I'd guess that the removal of trailing comments is perhaps an oversight. (It still seems to happen, at least for me with a recent snapshot.)
I wouldn't say this is a feature, exactly. But it's not inadvertent and I wouldn't say it's a bug. It's kind of a forced move to ensure greatest efficiency of hansl function code. We can fairly easily detect lines that are entirely comment, and store them but mark them as IGNORE for execution purposes. It would no doubt be possible, but would be a good deal more complicated, to preserve trailing inline comments.
So what is the recommendation for authors?
On 3/18/2026 7:21 PM, Allin Cottrell wrote:
Related
Bugs:
#329The more or less official recommendation right now is what you said before: if you want the comments to appear to the user in the code view, then only put them on separate lines, not inline.
Of course, for non-packaged functions and especially for your own codebase you can continue to put the comments wherever you like. Personally, I also use the inline commenting style a lot, but I understand that currently the cost-benefit ratio of preserving those inside a packaged function is too large.
So I'm going to close this.
I'm reopening this because I thought some more about the issue and realized there was a simpler way of preserving inline comments in function-package code. That's now in git, but needs more testing. I'm away from home right now but I'll put up new snapshots in a couple of days.
I tested this with some package code of my own with the latest snapshot and inline / end-of-line comments show up alright in the code view of the package.
So I would close this again, or did you have other tests in mind, @allin?
No, I think it can now be closed again.