HNHacker News
TopNewBestAskShowJobs

winterlight

46 karma · joined May 1, 2015

submissionscomments
winterlight··on What’s New in Python 3.7
Nope, that works just fine.

  >>> def f(*x): print(x[-1])
  >>> f(range(300))
  299
And surprisingly, in python 2.7, I was able to define a function that takes more than 255 arguments. But perhaps this only worked because I cheated and used exec.

  >>> exec("def f(" + ",".join("f" + str(x) for x in range(300)) + "): print(f299)"
  >>> f(*range(300))
  299
winterlight··on Rob Pike's Rules of Programming (1989)
The lookup method just checks whether an element exists in a collection or not. List and HashSet implement non-indexable collections, which have no notion of key. The Collection interface is very thin, and it's mostly used when you need to keep track of a set of elements. E.g. storing the nodes already visited in a dfs.
winterlight··on Rob Pike's Rules of Programming (1989)
Ironically, in that situation, using a list might end up being more efficient due to cache locality. Or not. That's why measuring is so important, since performance can be a very counterintuitive subject. Hard-data should always prevail over theory and guesswork.
winterlight··on Rob Pike's Rules of Programming (1989)
The interface is the same. For example, in C# you have an interface Collection, which offers a lookup method, and which both HashSet and Lists implement.

The point of the OP is that among different implementations for the same interface, choose the simplest one unless you have empirical evidence that compels you to do otherwise.

winterlight··on Firefox Multi-Account Containers
I tried this feature when it was available only in pilot mode. It was very nice and fitted quite well my uses. But the UX back then could use some improvements. For example, opening a new tab in a specific container took way too many clicks. And you couldn't just to CTR+T because it would always open the tab in the default container, rather than that of the active tab.
winterlight··on Show HN: Coinhive – Embeddable JavaScript Crypto Miner
It's creative approach to content monetization that solves some of the problems associated with ads, such as visual clutter. But mining is a computationally intensive process. So, in a world where this became commonplace, I can't see how you could have more than a few websites running on the client, contending for CPU power, without the end-user experience ending up being severely affected - and the revenue that content makers end up getting out of this as well.
winterlight··on Flow and TypeScript
I don't know about Flow, but in Typescript you can still fire up a REPL and play around. The difference is that the typechecker validates every command you run. This is enough for small experiences, e.g., when you want to validate an algorithm. But yes, in the case you want to rerun your application to test your changes, the feedback cycle is a bit longer. But I find acceptable considering that static-typing makes refactoring significantly easier and less risky, which is important when working on large projects.
winterlight··on Insane state of today's advertising part 3
My browsing experience on a mobile phone stepped up greatly since I started using Firefox Focus. You don't even need to mess around with plugins because ad blocking is already a built-in core feature.
winterlight··on Why does Google prepend while(1); to their JSON responses?
Modern web development is already hard by itself, specially when it comes to security. A saner runtime language is needed to replace the sub par standard that is javascript. One with a robust type-system and coherent semantics. It won't fix every problem, but a least it would prevent abuses such as the one in question.
winterlight··on How to Use Clojure for Scripting
What bothers me most about clojure is the abstraction leak when it comes to errors. When something goes wrong (say you passed a value of wrong datatype to a function), it just spits a java error stack. I'd like to have feedback closer to the conceptual level of the language, than to the intricacies of the run-time.
winterlight··on Show HN: Sodocan.js: Documentation Made Easy
There's a typo in the "What is sodocan.js" lane, right at the bottom of the 2nd paragraph.

natuarally => naturally

winterlight··on Category Theory abstractions for Clojure
Thank you. This is a lot of information to digest! But I think it helped me to see the beauty of this. When we map our programs into these well understood abstractions (monads, functors and stuff), we get for free means of combining them and handling them in very generic ways.
winterlight··on Category Theory abstractions for Clojure
Thank you. I've just finished the first chapter and it has been a pleasant reading so far. The mapping of "real world" onto Category Theory surely makes the matter more approachable.
winterlight··on Category Theory abstractions for Clojure
What is the value of Category Theory for programming? I'm genuinely interested, as my knowledge about this subject is little to none.