Live data from Hacker News

Go is boring

aeronotix.pl

131–138 of 138 posts

Re: Go is boring

#131

Earlier quoted context omitted.

You're not coming across as argumentative. By poor support for higher-order functions, I mean that e.g. you have to do "from functools import reduce, partial" for fold or partial function application. It's a trivial complaint, I'll give you, but it's one that's bitten me on more than one occasion (you think I'd learn!). There's also no foldr unless you implement it yourself. I badly misspoke when I said that you coul…

I don't understand. You can't pickle functions; when you pickle a function, you get a reference to the function, not the actual function code. E.g., this doesn't work: Dump.py: def isEven(n): return n % 2 == 0 import pickle with open('pickled','w') as dumpfile: pickle.dump(isEven, dumpfile) Loader.py import pickle with open('pickled') as loadfile: isEven = pickled.load(loadfile) This throws AttributeError: 'module' o…

When you pickle a function, you get a reference to the function, not the actual function code.

Right - that's usually what I want. (I've used pickle to store tests against game assets, e.g. that a model has all of its textures checked into perforce, or that a texture for a model does not exceed 128x128, unless otherwise specified). Marshalling functions is usually a non-starter for this, since a) it's complicated to analyse the call graph before execution, and b) native functions can't be marshalled - an awful lot of code executed against this asset pipeline is thin bindings over native/Java/C# code. Maybe I have found the 1% of the Python use-cases where lambdas suck a bit and everywhere else it's fine--it would be great if my experience was exceptional and no-one else had ever had a similar problem doing something else.

Re: Go is boring

#132
post #130

Earlier quoted context omitted.

How does one use that template? Can you show me a function that takes anything with a do() method? Like this?: do (a) do (b) Can I take any arbitrary type with an "int do()" method and use that with do? Like: do(Arbitrary)

"How does one use that template? Can you show me a function that takes anything with a do() method? Like this?:" It should work without the template parameter: do(a), do(b) "Can I take any arbitrary type with an "int do()" method and use that with do?" Yes.

cool

Re: Go is boring

#133

Earlier quoted context omitted.

I don't understand. You can't pickle functions; when you pickle a function, you get a reference to the function, not the actual function code. E.g., this doesn't work: Dump.py: def isEven(n): return n % 2 == 0 import pickle with open('pickled','w') as dumpfile: pickle.dump(isEven, dumpfile) Loader.py import pickle with open('pickled') as loadfile: isEven = pickled.load(loadfile) This throws AttributeError: 'module' o…

When you pickle a function, you get a reference to the function, not the actual function code. Right - that's usually what I want. (I've used pickle to store tests against game assets, e.g. that a model has all of its textures checked into perforce, or that a texture for a model does not exceed 128x128, unless otherwise specified). Marshalling functions is usually a non-starter for this, since a) it's complicated to…

Oh, ok. I don't know how Python could pickle a reference to an anonymous function, 'though.

Re: Go is boring

#134
post #130

Earlier quoted context omitted.

"How does one use that template? Can you show me a function that takes anything with a do() method? Like this?:" It should work without the template parameter: do(a), do(b) "Can I take any arbitrary type with an "int do()" method and use that with do?" Yes.

cool

As dan00 noted, it works without the template as long as there is no ambiguity. If there's an ambiguity (a template function defined on and to which you provide an int and a double) then you have to use explicit template parameter to specify which overload will be used.

It's not the case here, so it just works.

Re: Go is boring

#135
post #125
post #62

Earlier quoted context omitted.

> Python is single-OS-thread-only, and PyPy doesn't change that. Python uses native multi-threads, but the GIL restriction means only one thread can run at a time regardless of number of cores or processors you have. > If you write a lot of tests for your Python app, you might not have variable typos or function argument type mismatches, but in Go the compiler catches these things. Use pylint and/or syntastic(for vim…

For some reason, masklinn's comment is dead. Posting it here: > Python uses native multi-threads, but the GIL restriction means only one thread can run >> Can run Python code, if you're multithreading for e.g. IO the IO code will generally release the GIL. Yes, native code can release the GIL and run in parallel. As far as it's pure python, only one thread runs at a time. The options are multiprocessing, gevent style…

> For some reason, masklinn's comment is dead. Posting it here:

Sorry, that's probably because I got error messages while posting ending up with 2 or 3 comments, and I removed the extraneous ones. You probably tried to reply to one of those I deleted.

Re: Go is boring

#136
post #94

Earlier quoted context omitted.

I'd say xmonad[1]! It is a very light and fast tiling WM. There's also a couple of elegant and blazingly fast web frameworks, such as Yesod, Snap and Happstack[2]. 1: http://xmonad.org/ 2: http://www.haskell.org/haskellwiki/Web/Comparison_of_Happsta... http://stackoverflow.com/questions/5645168/comparing-haskell...

Installing xmonad requires several hundred megs of dependencies, so what does it mean for it to be light? Low memory footprint?

Pretty much. Hard disk space is still cheaper than RAM, so I think it's a good tradeoff. Plus those dependencies can be used for lots of other things.

Re: Go is boring

#137
post #116

C is boring too, in all the right ways. I think Go could be what we've been waiting for: C 2.0.

C's preprocessor means C code can often do interesting tricks, such as the X macro: http://www.drdobbs.com/the-new-c-x-macros/184401387

There are tons of other interesting uses for macros. Obviously I'd rather a language had safer equivalents to a C preprocessor.

Re: Go is boring

#138
The thing that makes me pull back from trying Go is the fact that it has no exceptions and no other feature for handling errors (correct me if I'm wrong).

Ugh! I can't imagine going back to the days when I had to call a function, check its return value to see whether there was an error or not, then, if no error, proceed to the next function call, check it for error, and so on.

I know exceptions were a source of "complexity", and you could say that Maybe monads or other programming attempts to solve the problem increase complexity too.

But to just punt and go back to doing it the ugly, unmaintainable brute force way? I just find that hard to swallow.

Post reply on HN