News for hackers. Stuff that matters.
Re:Google Go: A New Programming Language That’s Python Meets... by nailer on Wednesday November 11, 2009 @11:43AM (#935514)
I am taking it seriously, else I wouldn't have bothered replying to a blank 'i disagree' post with a polite request that you contribute to the discussion. The question is quite genuine - where in your view does the need for redundancy stop?
Re:Google Go: A New Programming Language That’s Python Meets... by jacquesm on Wednesday November 11, 2009 @12:09PM (#935554)
Braces have a very practical level of redundancy, they cost literally next to nothing in terms of effort and reduce a whole class of errors to 'impossible'.

Let me give you a simple example, in two psuedo languages, one with and one without braces:

   if a > b
     a = a + 5
     b = b / 2

   if (a > 0) {
     a = a + 5
     b = b / 2
   }
vs

   if a > b
     a = a + 5
   b = b / 2
or

   if (a > b) {
     a = a + 5
   b = b / 2
   }
Even though the text is similarly corrupted (for whatever reason) the redundancy in the second example makes it clear that something is amiss, you could even lose the second brace and still at least know that all is not kosher in that segment.

That's not 'ascii art', that's functional.

Redundancy definitely has it's uses.

I'm going to do some digging later on and find a bunch of examples of broken code due to cut & paste problems, some of it on the django site, no less.

That's something that would never happen in C or any other 'overspecified' language.

And regarding 'finding that matching bracket' that is exactly what they're for, if you can't match the bracket chances are that you really do have a problem in the code.

Re:Google Go: A New Programming Language That’s Python Meets... by nailer on Wednesday November 11, 2009 @01:04PM (#935682)
If you've spent any time with Python, it should be immediately clear that:

   if a > b
     a = a + 5
     b = b / 2
is quite different from:

   if a > b
     a = a + 5
   b = b / 2
Without needing a second markup for the compiler to emphasize the point.
Re:Google Go: A New Programming Language That’s Python Meets... by jacquesm on Wednesday November 11, 2009 @01:36PM (#935781)
Of course it is clear that they are different, that was not the point of the argument...

The point is that you can't know which one was the one that was meant to be written there in the first place, and all that changed is some literally invisible characters are gone.

It's like with comments and code, if a comment says 'add two volumes' and I see that the code does not do that then I have a hint that something is not correct.

It could be the comment or it could be the code, but there is something smelly there.

Redundancy = good.

Re:Google Go: A New Programming Language That’s Python Meets... by nailer on Wednesday November 11, 2009 @02:28PM (#935936)
'all that changed is some literally invisible characters are gone.'

Er, no. That's not the extent of the changes at all: the very visible code has shifted to the left. I refuse to believe you cannot see that with your own eyes.

'The point is that you can't know which one was the one that was meant to be written there in the first place'

In any language at all, the lack of indentation makes it quite clear the intention is different.

Re:Google Go: A New Programming Language That’s Python Meets... by pohl on Wednesday November 11, 2009 @03:20PM (#936123)
You've lost sight of jacquesm's premise, which is when 1) the intention is not accurately reflected by the indentation, and 2) does not break the syntax of the language.

You asked what benefit might come from the redundancy of a curly brace, and this was a scenario in response.

Re:Google Go: A New Programming Language That’s Python Meets... by nailer on Wednesday November 11, 2009 @03:43PM (#936174)
When the intention is not reflected by the indentation, you need to fix that, in every programming language.

Python also has the handy benefit of telling you this immediately.

jacquesm's statement about the visible difference is obviously false.

However I don't think it's doing anyone any good to keep contributing on this topic. All I was doing was making a suggestion to improve something. The troll who posted 'no' with no arguments has a bunch of supporters, I'm being moderated down to nothing. You're not responding to my points, and you seem to think I'm not listening to you, though I'm trying to understand what you're saying. I give up, this isn't worth it.

Re:Google Go: A New Programming Language That’s Python Meets... by pohl on Wednesday November 11, 2009 @04:38PM (#936329)
I'm only guessing, but the downmods may actually be because of disingenuous rhetoric. Example: "you need to fix that, in every programming language."

This problem only exists if indentation is significant in the language as a way of demarcating blocks. This is exactly the reason for the suggested syntactic redundancy. A reasonable person can accept the tradeoff, but it's not reasonable to insist that the tradeoff isn't there at all.

Edit: the proposed scenario is readable code. It is, in fact, disingenuous to ignore that. It isn't candid to claim apathy, either.

Re:Google Go: A New Programming Language That’s Python Meets... by nailer on Wednesday November 11, 2009 @04:51PM (#936363)
Needing to have readable code is a problem is every language.

If you find that disingenuous, fine, I don't care anymore.

Edit: you consider badly indented code readable? You must be great fun to work with. :^)

Re:Google Go: A New Programming Language That’s Python Meets... by pohl on Wednesday November 11, 2009 @05:54PM (#936538)
In my defense, Python would agree with me that it is readable: it would happily execute the line in the wrong block scope because of a single, invisible character was present or missing.

I bet you meant "semantically correct" instead. Yes, every program's semantics need to be correct in order for the program to be correct. That's a tautology, and it's a deflection from the subject of the tradeoff analysis that you requested upthread.

You're probably a bundle of joy to work with, too. :^)

Re:Google Go: A New Programming Language That’s Python Meets... by nailer on Wednesday November 11, 2009 @06:26PM (#936607)
No, I mean readable. For example:

   if (a > b) {
     a = a + 5
   b = b / 2
   }
...is not considered readable brace-requiring language because it's appearance doesn't reflect what's executed.

Ie:

* Python and similar languages would execute the code consistently with how it looks. This is good.

* A brace-requiring language would execute the code in a way that is not consistent with how it looks. This is not good.

Scroll up: I didn't request any analysis, I made a suggestion. Someone posted a blank 'no', and I asked them for a more civil explanation of their views.

Re:Google Go: A New Programming Language That’s Python Meets... by pohl on Wednesday November 11, 2009 @07:19PM (#936718)
...and I asked them for [an] explanation of their views

Yeah, that's the request I was referring to.

Python and similar languages would execute the code consistently with how it looks. This is good.

It's good and bad. You win something, you give up something. This is the nature of a tradeoff. It's not like Python lives in an alternate universe where tradeoffs don't exist. But I'm beginning to think its advocates live in one where tradeoffs are invisible in broad daylight.

Re:Google Go: A New Programming Language That’s Python Meets... by nailer on Wednesday November 11, 2009 @10:46PM (#937051)
'Yeah, that's the request I was referring to.'

Having an opinion thrust at you does not equate to soliciting said opinion.

It's your responsibility to clearly state the benefits of what you're advocating. You don't seem to be able to do that.

Re:Google Go: A New Programming Language That’s Python Meets... by jacquesm on Thursday November 12, 2009 @02:57AM (#937357)
Is it possible for you to have an argument without resorting to the personal ?
Re:Google Go: A New Programming Language That’s Python Meets... by nailer on Thursday November 12, 2009 @08:27AM (#937684)
This thread started with a contentless troll post. You've said things in this post that are provably untrue, and the other poster has accused me of being disingenuous. You've also moderated simple, globally accepted truths like 'unreadable code need to be fixed' past zero without replying.

I suggest you examine your own courteousness.