9 ms·
Extending the old adage "the best programming language is the one you know the best" to "the best programming language is the one you created the best".
by grabcocque 9y ago
Extending the old adage "the best programming language is the one you know the best" to "the best programming language is the one you created the best".
- visarga 9y agoReminds me of the "no free lunch" theorem from ML. To paraphrase, there is no language that is better than every other language on all tasks. https://en.wikipedia.org/wiki/No_free_lunch_theorem https://en.wikipedia.org/wiki/No_free_lunch_theorem
- TuringTest 9y agoAs a corollary, if you're using a general purpose language, there will always exist some domain where a Domain Specific Language will be equal or better.
- TeMPOraL 9y agoI view this as shifting complexity around. All Turing-complete languages are essentially equivalent, and there is some essential minimum complexity in any computation you'd like to describe. Any given language we use makes trade-offs, which cause some programs to be expressed simply in it, but the cost is that some other programs will become much more complex to express in it.
- TuringTest 9y agoMaybe, but comp-sci does not study all possible programs with equal probability. A notation should be optimized for the kind of problems that are more often studied, and make expressing those easier. If this pushes complexity towards the expression of randomly generated programs, that's a good thing (except for the few guys that study randomly generated programs, that is).
- TeMPOraL 9y agoYes. This is the general mental model I use when explaining that the design goal of a good general-purpose language is to shift the complexity to the areas almost no one will care about. Also your corollary from a sibling comment can be restated as saying that you can get extra simplicity for a particular task by designing DSL that will shift complexity to outside of its domain.
- tormeh 9y ago... which is why a certain class of programs is most elegantly described in brainfuck? Certainly there are tradeoffs to be made, but this does not mean that some languages are not simply better than others.
- TeMPOraL 9y ago> ... which is why a certain class of programs is most elegantly described in brainfuck? Possibly, though for sure those aren't programs you'd usually want to write. The key phrase of my comment was "essential complexity". You can pile up extra complexity that's not helping anything, but assuming you got rid of it, all you can do to make things easier is to shift the remaining complexity around the problem space.
- tormeh 9y agoI'd argue that no language in existence is even remotely close to having no extra complexity.
- tomp 9y agoThat obviously applies to all domains of life, but when it's actually said out loud, it's most often a cop-out. It's very improbably that the current-era languages are at (or anywhere near) the local optima of their respective niches. Sure, you don't want to issue database queries in C++ or write a high-frequency trading engine in JavaScript, but there's still a lot of progress being made, and to be made on every front of programming language development (syntax, type systems, semantics, libraries, compilation strategies, memory/resource management, ...).
- jasode 9y ago>improbably that the current-era languages are at (or anywhere near) the local optima of their respective niches. Your statement is true (e.g. Javascript/C++/etc syntax is suboptimal and could be better). However it's a separate concept from what grandparent posters' grabcocque and visarga are talking about. If we engage with their point, it's not a "cop-out" but stating an important fundamental truth about the syntax of all programming languages. Many beginners do not know this truth as can be seen by the following questions in the wild: - Why can't there be an “universal” programming language that serves all purposes? : https://softwareengineering.stackexchange.com/questions/4889/why-cant-there-be-an-universal-programming-language-that-serves-all-purposes https://softwareengineering.stackexchange.com/questions/4889... - ELI5: Why isn't there a universal programming language? : https://www.reddit.com/r/explainlikeimfive/comments/j2v84/eli5_why_isnt_there_a_universal_programming/ https://www.reddit.com/r/explainlikeimfive/comments/j2v84/el... - Why are there so many programming languages? : https://stackoverflow.com/questions/4334954/why-are-there-so-many-programming-languages https://stackoverflow.com/questions/4334954/why-are-there-so... - Why there are so many programming languages? Can't we create one language to do everything? : https://www.quora.com/Why-there-are-so-many-programming-languages-Cant-we-create-one-language-to-do-everything-It-would-just-be-easier-right https://www.quora.com/Why-there-are-so-many-programming-lang... The top voted answers in each case tries to explain it using analogies. (e.g. hammer is wrong tool for driving screws, etc). However, I'm not sure they actually provide the insight needed to make the questioner understand that creating the "One Universal Programming Language" is mathematically impossible. It's not possible to express multiple disparate concepts using finite characters with minimum string length for ease of typing and reading. All desirable concepts cannot simultaneously share the same minimal syntax for convenience. (This impossibility is also not solved by splitting concepts via language-vs-library as in "language reserved keywords" vs "library function calls".) (As an educational exercise, we could ask the questioner to try to invent a "One Universal Programming Language". He would soon run into contradictions rooted in trying to express multiple concepts via finite symbols. Eventually of those concepts he desires will end up being encoded with noisier and inconvenient syntax.)
- sampo 9y ago> https://en.wikipedia.org/wiki/No_free_lunch_theorem https://en.wikipedia.org/wiki/No_free_lunch_theorem This is a very theoretical result that people often overinterpret bease it has a catchy name. But it has no relevance for real world data.
- DonbunEf7 9y agoNo Free Lunch is very real, and occurs in many different guises under different masks. Here is an example constructive instantiation of No Free Lunch: https://blog.acolyer.org/2017/09/12/universal-adversarial-perturbations/ https://blog.acolyer.org/2017/09/12/universal-adversarial-pe...
- sampo 9y agoThat article doesn't mention no free lunch at all. Also, they're just calculating small perturbations that send the classifier over decision boundaries.
- stcredzero 9y agoAs I noted below, it could be argued that x86-64 is a universal programming language that currently serves all purposes across a very wide swath of all computation, modulo a number of interpreters, compilers, and VMs. (Even that doesn't take care of literally all, however.) So maybe there's no free lunch, but you can get lunch for a "coupon" in the form of a compiler or interpreter, which for many is close enough to free.
- carapace 9y agoAll Turing-Complete languages are universal. No Turing-Complete language is best for all problems. (That's why CPUs get GPUs, for example.)
- stcredzero 9y agoAll Turing-Complete languages are universal. No Turing-Complete language is best for all problems. But that doesn't mean they are or are not "fit for purpose." That brings in a lot of subjective and human factors.
- baldfat 9y agoThat is why Macros and creating your own DSL is so powerful :)
- JohnBooty 9y agoThis is purely my opinion but after working in the Ruby world for a few years I've concluded that DSLs are harmful as all hell. A DSL is almost never as well-implemented as a "real" language, ala Ruby/Java/Haskell/whatever. This is to be expected, as orders of magnitude more engineering time are placed in those "real" languages. Specifically, DSLs tend to be very leaky abstractions. I always find myself needing to look at what's happening in the bowels of the library providing the DSL anyway; a DSL essentially just adds another level of indirection. Particularly for beginners, but also for more experienced coders, it can be difficult to tell where the language and its core libraries end and the DSL begins. If your DSL "foo" seamlessly adds the command "bar" to language "baz" and it's not working for me, where do I look for information? In "foo" or "baz?" The obvious example here is Ruby on Rails. Some may say that Rails is a poor example of a DSL. While that may be, it raises the question: are there better examples out there? Given that the goal of a DSL is to blend into the underlying language, I'm not sure how any implementation would avoid those pifalls. To me, the best case scenario is that DSLs generally save a moderate amount of typing in exchange for a considerable amount of cognitive overhead.
- lmm 9y agoA good DSL is just a library - or at least, there's no clear sharp line between them. Likewise, I think good programming looks a lot like creating a DSL (or rather a succession of them, with a tower of interpreters from the business logic at top level down to lower-level DSLs until you get to one that can be interpreted directly by the machine). The difference between a good DSL and a bad DSL is that a good DSL lets you reason about it the way you reason about normal, plain old code: you can factor out repeated function calls, inline constants that are only used in one place, and so on, and it will all just work the way you'd expect. A good DSL should just be plain old code, as should most of the language standard library, and then it doesn't really matter whether a given function is part of the language or a library. I've been very happy with the Scala DSL experience; I'd suggest something like https://github.com/http4s/rho https://github.com/http4s/rho as an example.