Live data from Hacker News

GopherCon 2014 Videos

confreaks.com

71–75 of 75 posts

Re: GopherCon 2014 Videos

#71
post #69

Earlier quoted context omitted.

I think the way Go treats coding styles is great. I don't have any problems following a one true convention enforced by the language and being aware about the minute details of code structuring in order to avoid problems in translation. Funnily, the language that taught me all that was Python. As willvarfar points out, I feel Rob Pike is being disingenous when he talks about this. Golang uses less significant whitesp…

This seems like a logical fallacy. Of course you have to separate your language's tokens with something. This is not "significant" whitespace. It's token delimiters, and they don't generally need whitespace. for example func(){return 1} has no whitespace between func and the open paren, also func (){ a := 1 return a } while ugly, this still compiles just fine. It would compile just as fine if you randomly flipped som…

Did you know that almost all your example is perfectly doable in Python? Try this:

  def       my_func     (      )    :
      
      a        =      1

      return       a
It will run without a problem because only leading space is significant. Then you can mix tabs and spaces, add the space you want, blank lines, etc.

The Python coding style guideline (PEP 8) is very specific in that it recommends the use of 4 leading spaces per level. You can use a very simple program with regular expressions to solve any problem you could have in the mix of tabs and spaces in your files.

Now, try this example in FORTRAN.

  parameter(x=2)
  print*,"The parameter is ",x
Why can't I use commas or parentheses to delimit all the tokens in Go? Why does it insert semicolons without asking? Is such an arbitrary and problematic decision as the significant leading whitespace in Python.

Re: GopherCon 2014 Videos

#72
post #69

Earlier quoted context omitted.

This seems like a logical fallacy. Of course you have to separate your language's tokens with something. This is not "significant" whitespace. It's token delimiters, and they don't generally need whitespace. for example func(){return 1} has no whitespace between func and the open paren, also func (){ a := 1 return a } while ugly, this still compiles just fine. It would compile just as fine if you randomly flipped som…

Did you know that almost all your example is perfectly doable in Python? Try this: def my_func ( ) : a = 1 return a It will run without a problem because only leading space is significant. Then you can mix tabs and spaces, add the space you want, blank lines, etc. The Python coding style guideline (PEP 8) is very specific in that it recommends the use of 4 leading spaces per level. You can use a very simple program w…

Sorry, I forgot, you can also do this in Python:

  def my_func():a=1;return a;
Try it, it works!

Re: GopherCon 2014 Videos

#73
post #69

Earlier quoted context omitted.

This seems like a logical fallacy. Of course you have to separate your language's tokens with something. This is not "significant" whitespace. It's token delimiters, and they don't generally need whitespace. for example func(){return 1} has no whitespace between func and the open paren, also func (){ a := 1 return a } while ugly, this still compiles just fine. It would compile just as fine if you randomly flipped som…

Did you know that almost all your example is perfectly doable in Python? Try this: def my_func ( ) : a = 1 return a It will run without a problem because only leading space is significant. Then you can mix tabs and spaces, add the space you want, blank lines, etc. The Python coding style guideline (PEP 8) is very specific in that it recommends the use of 4 leading spaces per level. You can use a very simple program w…

I didn't specifically take the time to make code that would break in python, obviously, I could, and it would be trivial to do so.

Yes, it's just leading spaces that are different in Python, I know. I actually like python, but the space indenting is fragile.

Re: GopherCon 2014 Videos

#74
post #73

Earlier quoted context omitted.

Did you know that almost all your example is perfectly doable in Python? Try this: def my_func ( ) : a = 1 return a It will run without a problem because only leading space is significant. Then you can mix tabs and spaces, add the space you want, blank lines, etc. The Python coding style guideline (PEP 8) is very specific in that it recommends the use of 4 leading spaces per level. You can use a very simple program w…

I didn't specifically take the time to make code that would break in python, obviously, I could, and it would be trivial to do so. Yes, it's just leading spaces that are different in Python, I know. I actually like python, but the space indenting is fragile.

It's similarly trivial to make syntactically correct code that breaks in Go. Example:

  if (a == 1) {
      return a }
  else { return b }
This won't compile in Go. But whitespace wasn't significant in Go, right? Take out the curly braces, add a couple of colons and this will run without a problem in Python.

My point is, there isn't such a big difference between Go and Python. Significant whitespace doesn't mean "whatever Python does differently", it means that whitespace is syntactically meaningful. Any whitespace in any part of your program has the potential for changing the meaning of it. If it does, then it's significant.

It's trivial to make a text editor show tabs and insert spaces even if you press tab. It's trivial to make a program that will switch leading tabs for the number of spaces that you want from a file. I don't say it's trouble-free, but it isn't such a big issue; and automatic semicolon insertion isn't trouble-free either, as you can see. You won't have problems with any of them if you take a little care.

In Python, leading whitespace and newlines are syntactically significant. In Go, newlines are in many cases syntactically significant. In both of them space around many keywords is significant (try to write packagemain in Go, see how it goes), and you can't put whitespace in names.

Re: GopherCon 2014 Videos

#75

OK, who wants to put on a GopherCon 2015 next year, dedicated to actual Gopher[1][2][3][4]? I mean, there is a precedent for this sort of thing. http://iubio.bio.indiana.edu/soft/util/gopher/gophercon1.txt [1]: https://en.wikipedia.org/wiki/Gopher_%28protocol%29 [2]: gopher://gopher.floodgap.com/ [3]: https://addons.mozilla.org/en-US/firefox/addon/overbiteff/ [4]: gopher://sdf.lonestar.org/

I've been meaning to extend a Hakyll backend for Gopher sites, and then to set up a RPi gopher server and duplicating my site to it.
Post reply on HN