Page 1 of 1

Comments in Dfns

Posted: Thu May 20, 2010 12:11 pm
by paulmansour
In a recent Dyalog email it was noted that:

"We have been asked by several customers to allow comments to appear after the closing "}" in a dfn. Allowing this is a not insignificant piece of work, and has been added to the wish list for a future release of Dyalog APL."

I imagine this is signficant work because the closing brace ends the function, and thus by definition comments after the last brace are outside of the function and cannot simultaneously be inside the function. It would seem that should end the discussion right there. But if you are going to allow them after the last brace, why not before the first brace?

I hope this turns out to be one of the cases where the team says "well, if we do A, we should also do B, but we obviously can't do B, so lets not do A".

Really, this strikes me as a very bad idea, and a source of new problems.

What is the reason that simply adding comment lines within the body of the function, at the end, but before the last brace, won't do?

Re: Comments in Dfns

Posted: Thu May 20, 2010 2:12 pm
by kai
paulmansour wrote:In a recent Dyalog email it was noted that:
[...]
What is the reason that simply adding comment lines within the body of the function, at the end, but before the last brace, won't do?


Indeed. Maybe it's a misunderstanding: I reported this problem, but I am happy when APL won't crash. It hit me because I accidentally inserted a block of comments after the closing curly. Only when the stuff disappeared after having pressed the "Format" key I pressed the "Undo" key to get it back in order to move the block elsewhere when things ended up in an aplcore. Thats certainly not acceptable.

It could refuse to format/fix the function because the code is invalid. That would be enough.

Kai

Re: Comments in Dfns

Posted: Thu May 20, 2010 2:46 pm
by JohnS|Dyalog

Code: Select all

At present, when you exit the editor, anything after the closing brace is discarded:
┌dup─────────────────────┐
│dup←{                   │
│    ⍵ ⍵                 │
│}      all of this will │
│be quietly lost when the│
│edit window closes      │
└────────────────────────┘
Are we happy with this behaviour?
Or should we say "can't fix" and refuse to close the edit window?

Re: Comments in Dfns

Posted: Thu May 20, 2010 5:46 pm
by Phil Last
"Can't Fix" would indeed be entirely appropriate.

At present I can't fix a dfn if the closing brace is missing. What is required is to prevent the fix if the closing brace is not the last non white-space.

Re: Comments in Dfns

Posted: Thu May 20, 2010 9:14 pm
by kai
Fully agreed. Silently loosing code doesn't seem right.

Re: Comments in Dfns

Posted: Fri May 21, 2010 2:40 pm
by paulmansour
I agreem, seems like a good idea to me.

Re: Comments in Dfns

Posted: Fri May 21, 2010 2:51 pm
by JohnS|Dyalog
Now logged as official issue:
[6055] "⎕FX/editor should refuse to fix a D-fn if anything other than white space follows the closing brace."
Thanks for taking the time to get this right.
J.