3 ms·
> The thing is, this convoluted logic and raw access to pointers translate directly to CPU instructions very well. The OP isn't talking about this. The OP is s
by deltasevennine 4y ago
> The thing is, this convoluted logic and raw access to pointers translate directly to CPU instructions very well.
The OP isn't talking about this. The OP is saying at a basic level python/typescript is simply C++ with no pointers.
So the OP is asking can't we design a python-like language with pointers?
>For some personal opinion, I don't consider C & C++ complex languages. They're easy.
This is not an opinion shared by many. It's like someone saying they enjoy licking the ground. C++ is known for it's over complexity. It is complex mostly not because it's low level but because it's carrying around decades of design baggage and poor design decisions while being modern and backwards compatible.
>Otherwise it just goes bang, and it's a good thing in most cases.
Hard disagree. Low level programs can go bang at locations far away from the error and become incredibly hard to find. Additionally memory leaks are really challenging to find sometimes. These errors happen despite programmers knowing what they are doing as they are "mistakes" or bugs. These problems happen much less in higher level languages. C++ and C go bang at all the wrong times, while something like unsafe python goes bang at all the right times.
- mirker 4y agoMemory leaks still happen if you have a misunderstanding of memory management, regardless of language. Keeping references to dead objects is one straightforward way to do it. C++ also has smart pointers so it’s usually a case of someone writing code that is smarter than they are. One example: since some people in Python don’t think about memory they are prone to writing loops that grow memory proportionally to the loop counter in machine learning code (e.g., implicit graph references across loops).
- deltasevennine 4y ago>Memory leaks still happen if you have a misunderstanding of memory management, regardless of language. Apologies. What does this have to do with what I'm talking about? Not sure I said anything about memory leaks not happening in languages like python. I believe I said these issues happen "much less" in higher level languages so I'm not sure what you're trying to clarify here.
- mirker 4y agoWell I’m not aware of them happening “much less” just that there are less categories of bugs. We will of course rarely have software written with and without GC so it’s not an answer we will find. Memory leaks happen very frequently in managed languages e.g., http://ithare.com/java-vs-c-trading-ub-for-semantic-memory-leaks-same-problem-different-punishment-for-failure/#rabbitref-Sor17 http://ithare.com/java-vs-c-trading-ub-for-semantic-memory-l...
- deltasevennine 4y ago>Well I’m not aware of them happening “much less” just that there are less categories of bugs. We will of course rarely have software written with and without GC so it’s not an answer we will find. I would say your very inexperienced then. "Much less" is very obvious. Simply forgetting a delete operator or free in manual allocation leads to a memory leak. It is also proveable. Error surface area is smaller. delete and free don't exist in languages that exclusively use the GC for freeing memory thus you cannot "forget" to use those functions and thus error surface area is smaller, thus it must happen less frequently. >Memory leaks happen very frequently in managed languages e.g., http://ithare.com/java-vs-c-trading-ub-for-semantic-memory-l http://ithare.com/java-vs-c-trading-ub-for-semantic-memory-l... It happens but not frequently at all. I'm sorry. If you did manual memory management you would know this.