4,485 karma · joined Jun 30, 2015 (11y ago) · 2,043 submissions
comment 9y ago · link · parent
comment 9y ago · link · parent
Granted it has been getting easier as OOP languages have been slowly getting more and more functional features. But it really is easier to favour immutability and composition in a functional-first language.
comment 9y ago · link · parent
comment 9y ago · link · parent
From the link you posted: "all uses of the name within the block are treated as references to the current block"
The Python folks call them "late binding closures" and they are frequently discussed as "gotchas".
Essentially lexically scoped variables are captured as references to mutable state. Java did not make this mistake, perhaps because they had Guy Steele (of Scheme fame) on the committee. It is a questionable default that ultimately just destroys ones ability to reason about programs.
comment 9y ago · link · parent
There are plenty of things that Java got wrong. Threads and concurrent programming in Java is particularly difficult to get right without expert knowledge. Haskell makes concurrent programming much easier. I've worked with both professionally and feel that Haskell got more things right.
comment 9y ago · link · parent
State encapsulation, at least in FP, means that the state is not visible externally. For example a pure function that uses mutable state in its implementation. Such state does not contribute to the sytem global state.
> This is repeated as a mantra without any backup.
The more global mutable state your application has, the harder it is to reason about. That should be fairly obvious I think.
comment 9y ago · link · parent
Similarly that article is wrong to imply that all these techniques are unique to OOP.
comment 9y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
In contrast, functional programming makes state explicit. This makes it easier to manage and control state.
comment 9y ago · link · parent
EDIT: the reason why there is an explosion of state is because every object in OOP is potentially stateful. If I build a composite object Z from objects X and Y, the set of possible states Z has is a product of the set of possible states X and Y have.
comment 9y ago · link · parent
https://www.windowscentral.com/creator-first-start-menu-thin...
comment 9y ago · link · parent