6 ms·
The definition of "simple" and "complex" is very vague here. If we use Clojure's philosophy of simple, Python is by no means a simple language, even without cl
by cttet 5y ago
The definition of "simple" and "complex" is very vague here.
If we use Clojure's philosophy of simple, Python is by no means a simple language, even without classes. There are a lot of special syntax like `with` `as` `elif` `for .. else` and concepts such as `nonlocal`, not even mention generators, decorators and lots of fancy stuffs, although it is easy to learn...
I don't agree with the author that static type makes things more complicated... Instead type make things much simpler and easier to reason about.. In the Python's example, the author indeed like to reason about static typed systems...
And about classes, it is just a leaky abstraction legacy we have to deal with now..
"so they would have accidentally re-introduced classes"
definitely no.. We can use structs, traits, interfaces or much better ways for abstraction than classes, which was introduced with ideas for inheritance.
- IshKebab 5y agoStatic types are definitely make the language more complicated. It will have a bigger specification and more complicated implementation. You could even argue it makes writing programs more complicated. But they definitely also make writing programs much much easier. Kind of like how algebra is more complicated than basic arithmetic, but good luck proving Pythagoras's theorem without algebra.
- nbabitskiy 5y ago>> good luck proving Pythagoras's theorem without algebra. https://avatars.mds.yandex.net/get-zen_doc/48747/pub_5c9e493ce3ee0900b3277686_5c9f110f111e6e00b2e6e93f/scale_1200 https://avatars.mds.yandex.net/get-zen_doc/48747/pub_5c9e493...
- IshKebab 5y agoI don't understand. That uses algebra.
- nbabitskiy 5y agoThe proof is on the left, and doesn't require algebra. You can use another picture for the right part, like this https://microexcel.ru/wp-content/uploads/2020/05/kvadrat-summy-1.png https://microexcel.ru/wp-content/uploads/2020/05/kvadrat-sum... (it also uses algebraic notation which can be ignored)
- IshKebab 5y agoPythagorus's theorem is literally written using algebra. You can't even write it down without algebra.
- pritambaral 5y agoalgebraic notation != algebra It can totally be written without "algebra"; it's not the notation that contains the idea, it's only the idea that happens to be often expressed in this notation. I could use any other notation, or even plain English, to express the idea, if I didn't mind the extra verbosity. For Example: 1. The Berlin Papyrus 6619 (from 2000-1786 BC Egypt) uses prose [1] 2. The Ancient Chinese mathematical text Zhuobi Suanjing uses both prose and a pictorial notation [2] 3. The Baudhāyana Shulbasūtra (from 800-500 BC), a set of mathematical instructions for use in the construction of Vedic fire-altars, uses Sanskrit prose describing geometric constructions using rope [3] [4]. [1] https://en.wikipedia.org/wiki/Berlin_Papyrus_6619#/Connection_to_the_Pythagorean_theorem https://en.wikipedia.org/wiki/Berlin_Papyrus_6619#/Connectio... [2] https://commons.wikimedia.org/wiki/File:Chinese_pythagoras.jpg https://commons.wikimedia.org/wiki/File:Chinese_pythagoras.j... [3] https://en.wikipedia.org/wiki/Baudhayana_sutras#Pythagorean_theorem https://en.wikipedia.org/wiki/Baudhayana_sutras#Pythagorean_... [4] https://en.wikipedia.org/wiki/Shulba_Sutras#Pythagorean_theorem_and_Pythagorean_triples https://en.wikipedia.org/wiki/Shulba_Sutras#Pythagorean_theo...
- IshKebab 5y ago> algebraic notation != algebra Ha where did you get that crazy idea? > The Berlin Papyrus 6619 (from 2000-1786 BC Egypt) uses prose Just because it's prose doesn't mean it isn't algebra. For example "If you square the lengths of the two shorter sides together and add them up it equals the length of the square of the length of the longer side". That's just algebra with words. The thing that makes algebra algebra is that you use variables, not constants. "the length of the longer side" is just a wordy variable.
- alecst 5y agoGoogle Einstein’s proof of the Pythagorean theorem. I’ve won quite a few bets with it. :-)
- IshKebab 5y agoI did and they were full of algebra. Anyway as I've said elsewhere Pythagorus's theorem is an algebraic formula, so you can't even state it without using algebra. Converting the equation to prose doesn't mean it isn't an algebra anymore. The key feature of algebra is manipulation of variables.
- cttet 5y agoWhat I meant is that the word "complicated" is vague. Even if you a using a language with dynamic type, it just hides the unavoidable complexity behind. All the problems with types will resurface at the run time. The language by itself allows very complex interactions with types, just that the user not specifying it. For me I would add the behaviour of the language as part of the language complexity, not the written part only.
- Zababa 5y ago> If we use Clojure's philosophy of simple, Python is by no means a simple language, even without classes. There are a lot of special syntax like `with` `as` `elif` `for .. else` and concepts such as `nonlocal`, not even mention generators, decorators and lots of fancy stuffs, although it is easy to learn... Beware of the Turing tarpit where everything is simple but nothing is easy! Python is by no means perfect, but using different syntax when doing different things can make a lot of sense. "Everything is a X" can be a nice mental model, but on the other hand, as we've seen with classes, mixing data structures, structs and namespaces all in one concept is not always the best solution.
- cttet 5y agoYep, so as I said the definition of things like "simple", "complex" are super vague. | but using different syntax when doing different things can make a lot of sense. For C users yes, if we step back a little bit, for English users yes, but for people with other language background it may not hold. Every pieces of added syntax will utilise some human priors that may be specific to someone. But some really minimal systems can be grasped by every background, albeit taking a very long time.
- Zababa 5y agoMy idea behind "make things that are different look different" doesn't come from language (at least not written language) but from visual media in general. For example, on a industrial machine or in a guide, people will often use lots of trick to distinguish some things from other. It isn't really syntax, but considering that programming is written text, we don't have much else than syntax to differentiate the parts on a quick read. I think that may be a bias due to how I read code. I tend to skim it quickly at first, and then read the "more interesting parts" on a second pass. On the other hand, if you read code linearly, syntax may not be as needed. I'd like to see a study on eye movement when reading code and language preference, that may help reveal some patterns (or not.).
- jakobnissen 5y agoAuthor here. Indeed, when I tested off my idea on a friend, his first response what "But what is complexity? Is J a complex language? What about assembly?". It can get tricky once you get into the weeds. But from the comments here, it looks like most people got what I was trying to express. W.r.t whether types makes Python more complex - my point was that a type system makes the _language_ more complex, but it makes the _code_ using it easier to reason about. That's my main view of the blog post: Be careful trying to simplify a programming language if it leads to the code itself being more complex. And sure, I have no particular attachment to OOP "classes" as such, and I don't think they are necessary. In fact I much prefer Julia's approach. What I meant with classes being inevitable is that 1) structs, or something like structs, are inevitable, and 2) methods, in the sense of functions that are semantically tried to particular structs, are inevitable. In Python, these two things are provided by classes, so in Python, there really is no escaping classes.
- cttet 5y agoThe big or small language problem have been debated quite a long time, for what I know especially in the scheme community. There are a lot of insightful discussions about R6RS, which you may find interesting.