2 ms·
> Programming languages have a lot in common with natural languages. Can you substantiate this claim? They're not used in the same way, their learning patterns
by lmm 5y ago
> Programming languages have a lot in common with natural languages.
Can you substantiate this claim? They're not used in the same way, their learning patterns are different; the fact that we use the same word is coincidence more than anything IMO.
> At worst, it leads people into "golden hammer" thinking about the tools they use. The "zero sum" thinking as you've pointed out, then reveals itself for what it is: a self-fulfilling prophecy, self inflicted by tool-centric thinking.
Nonsense. The advantages of having good tooling and ecosystem are very real and concrete. If anything, the idea that particular programming languages are useful in particular problem domains is a lot more of an self-fulfilling prophecy - in my experience any halfway decent general-purpose programming language can be used in every domain if you actually try, usually the only reason to prefer a language with a good reputation in that domain is because there tend to be more libraries and so on, but that itself happens for purely circular reasons.
(If you really believe that programming languages are like natural languages, wouldn't you expect programmers to pick one and use it for everything?)
- mjburgess 5y agoThey mean extrinsically, rather than intrinsically. Their properties are essentially nothing alike. P-langs not having a semantics in anything other than a metaphorical sense. Their extrinsic properties are similar insofar as they are inventions of human beings which have some socio-cultural dimension.
- tialaramex 5y ago> in my experience any halfway decent general-purpose programming language can be used in every domain if you actually try That's going to be an extremely limited experience. Most of the world's general-purpose languages have a heavy runtime. The runtime is expected to provide the running program with all manner of conveniences, but one very common item that you've probably imagined is just "universal" is an allocator so that you can... allocate memory. Nope. What programming language do you think the allocator is written in? Languages like C and Rust are designed with such a runtime as only an optional extra, so that you can in fact write the allocator in those languages.
- lmm 5y ago> Most of the world's general-purpose languages have a heavy runtime. "Heavy" by 1970 standards perhaps. When e.g. ML was first created, the newest and fanciest PCs had 512Kb of RAM. Nowadays if you wanted to buy a microcontroller with such a small amount of RAM you'd have to pay extra because you're asking for a lower-volume specialised part. > What programming language do you think the allocator is written in? Any language where someone actually bothered to actually try to write one - writing them in high-level languages has been done plenty of times with plenty of techniques (perhaps most elegantly in T by just carefully writing the allocator code such that it's not doing any allocations in the allocator itself). "Not actually needing to write a custom allocator" is also very easy in every domain if you actually try, IME.
- tialaramex 5y ago"by just carefully writing the allocator code such that it's not doing any allocations in the allocator itself" The tautology you've inadvertently described there isn't actually an allocator. Isn't that fascinating? I can't tell if you were trying to be clever or if you just didn't see what you were doing. What's actually going on is that T is sat on top of an entire operating system (often a Unix) which provides it with an allocator. It then uses garbage collection so that the lay user needn't worry about, like many high level languages.
- AnimalMuppet 5y agoNo, it can be done. In Java, say, you have a giant static array. You allocate chunks of that. You can then return to the caller a block of memory without you ever having to call the OS's allocator. But I disagree with lmm's larger point, and I will give my own example of it. Here's an embedded system that controls the wing surfaces on a fighter aircraft. It has to adjust them every 1/40th of a second, or the wings break off (not an exaggeration). So a big part of the development process is proving that you always meet that timing. You do things like count the CPU cycles used by the code that the compiler generates. Then someone says "let's use a garbage-collected language!" Worse, they may even suggest a language that automatically allocates. They might say that you can get garbage collectors and allocators that have guaranteed-worst-case timings. But even then, you have to count the allocations, multiply by the worst-case time of an allocation, and figure in the garbage collection time. And you're faced with a bunch of cynical embedded engineers, asking "Explain to me again how this makes our lives easier?" And you can't, because it doesn't. You can write just about anything in just about any language. But software engineers aren't stupid, and they aren't sheep. The tools typically chosen for an area are usually better for doing actual work in that area.
- CaptArmchair 5y ago> in my experience any halfway decent general-purpose programming language can be used in every domain if you actually try If all other things were equal, yes. But the vast majority of people who sit in front of an editor are facing hard constraints such as scope, cost and time. The usefulness or suitability of any tool - including programming languages - is a function of those variables. Is it possible to write a 3D engine in Perl? Yes. Not arguing with you there. Is it an exercise in masochism? Depends on where you're coming from, what your goals are and which constraints in terms of time and budget available you're facing. The quantity of libraries which emerge around a language isn't that consequential. The number of libraries which are relevant to my particular problem or challenge is the metric that matters. Metacpan offers 250.000 Perl modules. But that masochistic video game developer won't be interested in the plethora of data manipulation packages and instead lament an acute shortage of decent and performant 3D rendering libraries.