On Tuesday, 3 May 2016 at 03:48:09 UTC, Joe Duarte wrote:
Would it be difficult to compile the clean version?

You realize your bias is showing very strongly in the wording of this question, right? I don't agree the naked version is clean at all.

ohimsorryletswritemorecleanlywithoutanyofthatobnoxiouspunctuationnoiseitisalluselessanywaysurelyyoucanstillmakesenseofthisafterallthereareonlysomanywordsintheenglishlanguageandknowinghwatdoesanddoesntmakesenseincontextmeansyoucansurelyparsethisrightout

oh i know you will say thats not a fair comparison it is the punctuation you dislike not the spacing though really the same principle applies actually while the punctuation does have meaning ill concede you can nevertheless parse it without although you might then want other rules

see in a lot of those languages they redefine things like lines to serve the same role as the punctuation

so like instead of ending expressions in punctuation

they end them with a new line instead

meaning you must hit enter at the point that d would allow you to use the semicolon

ditto for indentation

like sure this is readable

but it just bothers me to use as a matter of course

it can even become

~hideous~

crap i cant even use ~ wtf this style of writing sucks it just isnt very expressive nor artistic

* * *

Personally, I sometimes do like writing in all lower case without punctuation, but I do so as a style choice; it tends to be my way of expressing in text that I'm not being entirely serious, in contrast to ordinarily formatted text.

Code is the same thing - I will use different styles for different situations.

It isn't a terribly difficult technical problem to define a programming language to have a different syntax. You can parse them without that much trouble.

But the syntax isn't really there for the compiler's benefit (though there are benefits there, just like asking the user to confirm their email address, getting a bit of redundant information out of the human user can help catch mistakes), it is there for the reader.

I often get lost when there's several levels of whitespace change at once.

def pain:
  if whatever:
    do this
    if this_too:
      also do this
      if one_more:
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
        oh snap this is kinda long
        it takes several lines
    quick where we at?



Curly braces in there would show we intended to go a couple levels and give a convenient place to click to ask our editor program to show us where it started too. I really like having that.


Semicolons similarly are a nice way to say "I'm done with this thought", which I'm just used to hitting. When I use languages that don't allow them, I waste quite a bit of time hitting backspace after automatically hitting ;!

Moreover, with a longer line, (or in some cases like debug lines where I want to easily remove two statements with one keypress - yes, my editor can delete a line instantly, but two lines are a bit harder to do) the semicolon gives you the freedom to format it as you will.


a = 5 +
    4 -
    1;

That'd work without the semicolon (usually), but this is different:

a =   5
    + 4
    - 1;


In that case, the line break after the 5 would probably end the statement, leaving the other numbers dangling.

I prefer this formatting in many cases though since then the operators nicely line up. In the first one, the 4 is visually tied to the -, but really, the - is more strongly related to the 1, so I want them grouped together.


Well, I'm late, but to sum up:

* familiarity brings comfort, to look and in using existing workflows like my editor's delete-line feature.

* breaking habits, regardless of whether those habits are perfect in a perfect world, is a source of mental friction that has higher cost than benefit

* punctuation separate from styling leaves both as independent decisions that brings more beauty

It isn't so much that they are necessary, it is that they bring various other benefits.


I'm a social scientist and I'm preparing some studies on
the effects of programming language syntax on learning,
motivation to pursue programming, as well as any disproportionate effects that PL syntax has on the appeal
of programming to women (more on the latter in a separate
post).

fascinating, I might tell you some stories from my youth later, but right now, I'm too old to be up this late!

But I'm really curious what the gendered aspect turns out as. I suspect the effect, if it indeed exists, would be strongly tied to the oft-repeated lie that "girls aren't good at math" - math famously uses a lot of symbols, so that association could recall discouraging memories.

Reply via email to