Comments on RFC for .. and ...

From J Wiki
Jump to navigation Jump to search

Proposed addition of .. for comment delimiter and ... for line continuation

  • The J word .. when not further inflected, is equivalent to NB., starting a comment that ends at the next end-of-line (LF).
  • The J word ... when not further inflected, is equivalent to NB., starting a comment that ends at the next end-of-line (LF), and the following line is appended as J words in place of the ....


  vec =. i. #y  .. index vector of length #y
  adj =. +/   ... add the weighted values
         vec * y   ..  weight each element of y by its position

Add Your Comments Below, starting them with <p> and signing your name with ~~~~

Hi Henry, I presume your line continuation scheme will work both inside and outside of all explicit definitions. I'm guessing the use of two words ... and .. is to facilitate many continued lines, e.g.

  this =. is a big  ... Dr. Who
           ball of  ... recommends comments
           fuzzy    ... for long lines
           wuzzy    ...
           J stuff  ..

This will certainly encourage tacit abusers (you know who you are) to present code in more digestible chunks. And will also provide some options for intelligent line breaking in J pretty printers.

Right. The ... is the essential addition; .. is merely a replacement for NB. that some consider less obtrusive. Henry Rich (talk) 17:59, 17 January 2024 (UTC)

Some have asked for an internal line-break; something that would start a new line without LF. Considering that [ does an admirable job of that, I have left it out. Henry Rich (talk) 17:59, 17 January 2024 (UTC)

Long-lineitis is more than long tacit lines. Even a long line of name executions will benefit from having more points to hang comments on. Henry Rich (talk) 18:02, 17 January 2024 (UTC)

I don't see the need for a new commenting syntax; NB. is fine, and more visually distinctive besides. Also, .. as sentence-break would be functionally different from [, whereas .. as comment syntax would not enable anything new. Also, it has been pointed out that it's strange that NB.. (etc.) does not start a comment; it might be good to change that, but of course, it would be problematic if ... started a comment. Elijah Stone (talk) 06:22, 19 January 2024 (UTC)

Also, note that inline comments are already supported for noun phrases, for example ['comment'] and [. could be used in some other contexts. And, finally, it's probably good for a comment token to stand out. For example, consider ): (or, if that seems too unhappy, (:). --Raul Miller (talk) 14:38, 19 January 2024 (UTC)

[ only serves as a line break when separating noun phrases. That said, sometimes you can hack an alternative approach, for example {{m=.5!:6<'u'}} to work around the difficulty of using )a on a single line. Raul Miller (talk) 14:23, 19 January 2024 (UTC)

I didn't think much of .. as an alternative to NB. until I looked at a large example. The NB. is heavy on the page. .. is recommended by aesthetics, not logic.

Elijah, what is problematic about ... starting a comment? (Maybe you mean .... ...: etc.)

NB.. is a different word from NB. I don't see the need to expand the class of comment delimiters.

Can anyone say that they have needed an inline sentence break that couldn't be handled by [ or [. ? Inline sentence breaks are troublesome to implement except as control words. Henry Rich (talk) 16:11, 19 January 2024 (UTC)

I like an idea with ... . And I'm doubt the need for .. as yet another NB. (it's good to have the only tool for one task). So anyone of the following JE modifications seems good to me:

  • drop NB. and use .. and ... as proposed here;
  • use NB: as line continuation (instead of ... proposed by this RFC), use NB. as the only comment delimiter.

Igor Zhuravlov (talk) 13:35, 27 January 2024 (UTC)

I like this. I would use .. instead of NB. all the time, as its is at least 3x faster to type. should be possible to nest ... as in
avg =. +/ ... sum
% ... divide
(#) .. count

Pascal Jasmin (talk) 16:22, 25 February 2024 (UTC)

I like both of them, especially ... as it's an ellipsis, making it clear the code continues as if on one line. .. is indeed far faster to type than NB., and congruent with ... Jan-Pieter Jacobs (talk) 20:01, 28 February 2024 (UTC)

I agree with previous comments: I like both. It is much better ergonomics to type .. than NB. for comments. Pete Padilla (talk) 17:11, 23 April 2024 (UTC)

I may be commenting too late for it to matter, but I like both very much. --Cameron Chandoke (talk) 05:04, 8 July 2024 (UTC)