Live data from Hacker News

Open source code with profanity in comments is statistically better

blog.desdelinux.net

111–120 of 221 posts

Re: Open source code with profanity in comments is statistically better

#111

From the research paper: > we calculate the swear factor as the number of swearwords divided by the lines of code That's what I suspected. Assuming that most swear words will be contained in comments, what this is actually measuring is the ratio of comments to code. In other words, code that is more heavily commented is better. I think we already knew this. That said I would like to see a more critical analysis. Firs…

I never write comments, and I think they typically have a negative correlation to quality (this code is so f**ed up, plain english is, of all things, more clear and precise than code!). Unless you are releasing code publicly, and you are documenting the public API, I've never seen a valuable comment. I've seen plenty of harmful comments. However I wholeheartedly endorse using this otherwise useless but common languag…

you've never seen a useful comment?

Re: Open source code with profanity in comments is statistically better

#112
The original terminal emulator terminal.el in gnu emacs, written by mly (Richard Mlynarik), was particularly salty. I finally tracked down a copy, but it looks like somebody complained and in 1990 it was begrudgingly cleaned up a bit, so some of the worst stuff was moved out into a separate file called term-nasty.el for posterity (you, here, now), so as not to give "in to the pressure to censor obscenity that currently threatens freedom of speech and of the press in the US" (oh, Richard https://opensource.apple.com/source/emacs/emacs-59.0.80/emac...

1990-08-26 Richard Stallman (rms@mole.ai.mit.edu)

* terminal.el: Move possibly offensive comments to term-nasty.el.

https://www.digiater.nl/openvms/freeware/v10/emacs/common/li...

[...]

    ;; disgusting unix-required shit
    ;;  Are we living twenty years in the past yet?

    (defun te-losing-unix ()
      nil)
[...]

    ;; (A version of the following comment which might be distractingly offensive
    ;; to some readers has been moved to term-nasty.el.)
    ;; unix lacks ITS-style tty control...
    (defun te-process-output (preemptable)
      ;;>> There seems no good reason to ever disallow preemption
      (setq preemptable t)
[...]

              ;; I suppose if I split the guts of this out into a separate
              ;;  function we could trivially emulate different terminals
              ;; Who cares in any case?  (Apart from stupid losers using rlogin)
[...]

                                     (?\C-b . te-backward-char)
                                     ;; should be C-d, but un*x
                                     ;;  pty's won't send \004 through!
                                     ;; Can you believe this?
[...]

                                     ;; Did I ask to be sent these characters?
                                     ;; I don't remember doing so, either.
                                     ;; (Perhaps some operating system or
                                     ;; other is completely incompetent...)
[...]

                         ;;-- Not-widely-known (ie nonstandard) flags, which mean
                         ;; o writing in the last column of the last line
                         ;;   doesn't cause idiotic scrolling, and
                         ;; o don't use idiotische c-s/c-q sogenannte
                         ;;   ``flow control'' auf keinen Fall.
                         "LP:NF:"
                         ;;-- For stupid or obsolete programs
                         "ic=^p_!:dc=^pd!:al=^p^o!:dl=^p^k!:ho=^p=  :"
                         ;;-- For disgusting programs.
                         ;; (VI? What losers need these, I wonder?)
                         "im=:ei=:dm=:ed=:mi:do=^p^j:nl=^p^j:bs:")))
[...]

              (setq te-process
                    (start-process "terminal-emulator" (current-buffer)
                                   "/bin/sh" "-c"
                                   ;; Yuck!!! Start a shell to set some terminal
                                   ;; control characteristics.  Then start the
                                   ;; "env" program to setup the terminal type
                                   ;; Then finally start the program we wanted.
                                   (format "%s; exec %s"
                                           te-stty-string
                                           (mapconcat 'te-quote-arg-for-sh
                                                      (cons program args) " ")))))
[...]

    ;;;; what a complete loss
[...]

https://www.digiater.nl/openvms/freeware/v10/emacs/common/li...

    ;;; term-nasty.el --- Damned Things from terminfo.el
    ;;; This file is in the public domain, and was written by Stallman and Mlynarik

    ;;; Commentary:

    ;; Some people used to be bothered by the following comments that were
    ;; found in terminal.el.  We decided they were distracting, and that it
    ;; was better not to have them there.  On the other hand, we didn't want
    ;; to appear to be giving in to the pressure to censor obscenity that
    ;; currently threatens freedom of speech and of the press in the US.
    ;; So we decided to put the comments here.

    ;;; Code:

    These comments were removed from te-losing-unix.
      ;(what lossage)
      ;(message "fucking-unix: %d" char)

    This was before te-process-output.
    ;; fucking unix has -such- braindamaged lack of tty control...

    And about the need to handle output characters such as C-m, C-g, C-h
    and C-i even though the termcap doesn't say they may be used:
    ;fuck me harder
    ;again and again!
    ;wa12id!!
    ;(spiked)

    ;;; term-nasty.el ends here
Note to the gentle readers: "wa12id" stands for "with a 12 inch dildo".

Jamie Zawinski kept Lucid Emacs nasty:

https://groups.google.com/g/gnu.misc.discuss/c/U5oXKOfWinQ/m...

Noah Friedman, Aug 3, 1992, 4:54:20 AM

In article wood...@hal.com (Nathan Hess) writes:

>In article , friedman@gnu (Noah Friedman) writes:

>>It's by no means necessary, but it's funny.

>Along the same lines, look at lisp/terminal.el

Of course, terminal.el is actually useful, albeit not terribly powerful.

(and terminal.el is pretty mild compared to some of the other things I've seen written by mly. :-))

Incidentally, a lot of terminal.el has been rewritten in version 19.

Too bad... I liked all the variable names and comments in the original.

Jamie Zawinski, Aug 5, 1992, 12:40:38 AM

In the FSF-distributed Emacs 19, the obscenities (will) have been stripped from terminal.el, though they are preserved in a file called term-nasty.el, to avoid appearing to bow to the censors.

In Lucid GNU Emacs, terminal.el will remain as nasty as it ever was.

-- Jamie "Truth, Justice, and the Fucking First Amendment" Zawinski

Re: Open source code with profanity in comments is statistically better

#113

One rule I live by is I never ever swear in comments or commits, just not worth it. Even in personal projects. But one of my favorite projects to ctrl-f for "fuck" is in the jedi outcast source code. Since it is proprietary and was a good game: https://github.com/search?q=repo%3Agrayj%2FJedi-Outcast+fuck...

I'm guessing the multiple instances of

  i  = 0x5f3759df - ( i >> 1 );
in the results are one of those inverse-square floating point bit tricks.

Re: Open source code with profanity in comments is statistically better

#114
post #5

I'd bet a lot of the non-profanity code is people open sourcing code just to be impressive on resumes or for school, where the profanity code is probably real code. Sounds likely to be a classic case of correlation != causation

Nobody suggested causation. The idea that you can improve code quality by adding profane comments is so self-evidently absurd that nobody would even suggest such a thing. Except you kind of just did.

Re: Open source code with profanity in comments is statistically better

#116
post #80

Earlier quoted context omitted.

The jury is still out if I'm a good programmer, but I did one time need to use a hashmap that had to grow to about ~100gb in size. Because of that, I ended up calling it "bigassHashTable". It makes me happy that it remained being called that for quite awhile.

I remember a day at a previous job when our CEO came in and told us we weren't an early stage startup anymore and had to start acting like it. Remove profanity and inside jokes from the code, and no more Quake during lunch breaks. Morale took a big hit that day.

if a CEO did that to me I'd just tell him to pull the stick out of his ass. none of it has anything to do with maturity.

but I'm relatively old.

you can Quake (or Overwatch or whatever the current game is) during lunch breaks at every FAANG, for christ's sake. (it's different if you're playing it during working hours.)

Re: Open source code with profanity in comments is statistically better

#118

Earlier quoted context omitted.

That’s a pretty big leap IMO. What gives you that impression?

Not that commenter, but with 20 years of experience in open source I share their hypothesis. Language policing slows down technical progress, very significantly I would wager.

Agree. You'll never get a count of all the people who may have been interested in contributing to a project but decided against it because of a COC or language police.

Re: Open source code with profanity in comments is statistically better

#119
While at Sun in the early 2000's, I was part of the due diligence team for an acquisition and had two days to review the entire code base of a 3 year old, 50 person software team.

This was standard practice, and the M&A policies knew that there was no way to actually understand all the code so there was a policy document to describe what to look for.

Of course the red flag things were unexpected 3rd party copyrights and/or license terms in case the code was encumbered.

But "swear words" were on the yellow flag list, in addition to "ToDo", "XXXX", and "Fix Me" types of things.

I remember thinking about places I have been in the past and that the people used those style comments tended to be the better programmers.

I mentioned this to the person leading the evaluation, and was told that point of noticing these kinds of comments was to look a more closely at the nearby code and try to decide if major functionality was missing or being faked.

It all worked out for that acquisition, but I remember being curious about whatever deal had gone bad in the distant past that made them codify this specific practice.

Re: Open source code with profanity in comments is statistically better

#120

When we open sourced the Netscape Navigator a major undertaking was code sanitation. This including excising licensed libraries etc (resulting in an initial release that wasn’t able to compile), but also removing enormous amounts of profanity and references to how evil Microsoft was.

JWZ sure could flame in the comments, especially about Motif.

http://www.art.net/~hopkins/Don/unix-haters/x-windows/motif....

Post reply on HN