- Aug 2022
-
-
and free of globals
Ah! This remark highlights a fundamental difference in understanding between two camps, which I have been (painfully) aware of, but the source of this confusion has eluded me until only just right now. (Really, this is a source of frustration going back years.)
In one camp, the advice "don't use global variables" is a way of attacking a bunch of things endemic to their use, most notably unnecessary coupling to spooky state. In another camp "no global variables" is understood to mean literally that and taken no further—so you can have as much spookiness as you like, and so long as the value is not directly accessible (visible) from, say, another given piece of code appearing at the top-level ("global") context, as with the way
i
is bound to the activation record in this example but is not accessible outside the scope ofgetGetNext
, then you're good.That is, there are two aspects to variables: visibility and extent, and the first interpretation seeks to avoid the negative effects on both dimensions, while the second is satisfied by narrowly prohibiting direct visibility across boundaries.
I find the latter interpretation bizarre and completely at odds with the spirit of the exhortation for avoiding globals in the first place.
(What's worse is the the second interpretation usually goes hand in hand with the practice of making extensive use of closures, which because they are propped up as being closely associated with functions, then leads people to regretfully refer to this style as functional programming. This is a grave error—and, to repeat, totally at odds with the spirit of the thing.)
-
-
gbracha.blogspot.com gbracha.blogspot.com
-
they're called objects, and everybody has them
Even most ostensible FP practitioners who swear they don't.
-
-
news.ycombinator.com news.ycombinator.com
-
Related: much of functional programming is not even functional. Closures end up doing a lot of heavy lifting, despite being at odds with what FP claims to be.
-
- Jul 2021
-
colah.github.io colah.github.io
-
Using multiple copies of a neuron in different places is the neural network equivalent of using functions. Because there is less to learn, the model learns more quickly and learns a better model. This technique – the technical name for it is ‘weight tying’ – is essential to the phenomenal results we’ve recently seen from deep learning.
Tags
Annotators
URL
-
-
people.inf.ethz.ch people.inf.ethz.ch
-
Functional programming implies much more thanavoiding goto statements, however.It also implies restriction to localvariables, perhaps with the excep-tion of a few global state variables.It probably also considers the nest-ing of procedures as undesirable.
-
- Dec 2020
-
doc.rust-lang.org doc.rust-lang.org
-
Note: The examples in Listings 10-17, 10-18, and 10-24 declare variables without giving them an initial value, so the variable name exists in the outer scope. At first glance, this might appear to be in conflict with Rust’s having no null values. However, if we try to use a variable before giving it a value, we’ll get a compile-time error, which shows that Rust indeed does not allow null values.
-
- Dec 2019
-
dev.to dev.to
-
The easy, functional-programming concept that a component can receive both functions AND data as arguments
Injecting a function, a fp concept, to enable testing
-
- Jul 2019
-
spark.apache.org spark.apache.org
-
Given a dataset of transactions, the first step of FP-growth is to calculate item frequencies and identify frequent items. Different from Apriori-like algorithms designed for the same purpose, the second step of FP-growth uses a suffix tree (FP-tree) structure to encode transactions without generating candidate sets explicitly, which are usually expensive to generate. After the second step, the frequent itemsets can be extracted from the FP-tree.
-
- Mar 2018
-
blog.functorial.com blog.functorial.com
-
PureScript does not support GADTs
-
- Jan 2018
-
byorgey.wordpress.com byorgey.wordpress.com
-
Whereas normal type classes represent predicates on types (each type is either an instance of a type class or it isn’t), multi-parameter type classes represent relations on types
-
- Sep 2017
-
developingthoughts.co.uk developingthoughts.co.uk
-
Building a Maybe in JavaScript
js functional programming
-
- Apr 2017
-
softwareengineering.stackexchange.com softwareengineering.stackexchange.com
-
Coupling your data and code adds the additional problem that if you want to use a function at a certain point, you have to find a way get its object to that point.
-