3 ms·
IMO magic is the result of one of three things 1. Developer does not have enough imagination to create necessary abstractions without resorting to magic. 2. D
by vbezhenar 7y ago
IMO magic is the result of one of three things
1. Developer does not have enough imagination to create necessary abstractions without resorting to magic.
2. Developer does not like commonly accepted approach to solving things in that particular language.
3. The language is objectively not expressive enough and magic is necessary.
IMO everyone thinks that it's 3-rd point, but it usually is #1 or #2.
- brundolf 7y agoA good example of "magic" that is 100% worthwhile is the MobX library (I may actually write a post on it soon). A few key things that make this the case: - It accomplishes something that would be dramatically messier and more error-prone in the host language without the use of magic - It introduces a very small number of "magical" concepts, and their behavior WRT the outside world is very intuitive - While every abstraction has leaks, the ones in MobX gravitate towards performance rather than correctness. I.e. it virtually always does what you expect, and usually does it efficiently. - It provides trap-doors and hooks for dealing with every possible abstraction leak you might run into