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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.