4 ms·
Unfortunately, that's not how languages work. There may be language equivalence classes (that would put, say, Ruby, Python and JS in the same class, C, C++ and
by pron 12y ago
Unfortunately, that's not how languages work. There may be language equivalence classes (that would put, say, Ruby, Python and JS in the same class, C, C++ and Rust in another, and Java, C# and Go in a third), but languages from different classes can't just be translated from one to the other. First, a program written in one language isn't just a description of an algorithm, but a description of the algorithm plus language-specific information that's supposed to help the particular platform execute the algorithm efficiently. Second, there are essential runtime differences that can't be easily ported, such as a threading model and a memory model -- and those may significantly affect the suitability of an algorithm for a certain language. Finally, there are fundamental differences in the appropriateness of certain algorithms; specifically, imperative algorithms can't be automatically translated to pure-functional algorithms without possibly changing their time and space asymptotic complexity.
In short, there's a lot more to a computer program than a description of an algorithm, and even algorithms vary considerably in their suitability depending on the language/runtime executing them. Even if you could solve the first problem, you're still left with the second.
I do agree with the premise, though: unless your new language/runtime is so revolutionary that it reduces development cost dramatically, fracturing the ecosystem is often too high a price to pay for merely a
"nice" improvement. The problem is that many languages claim dramatic cost reductions, but it usually takes years to learn whether or not they deliver. The reason for that is not just the number of data points, but the fact that the cost of software is spread across a codebase's lifetime (10 years is about the average lifespan of a production system codebase), and how development looks -- and what activities contribute to costs -- in the first and second year is very different from how it looks in the sixth.
- nulltype 12y agoHilariously we seem to be getting code reuse mostly through network services these days instead of language specific libraries.
- pron 12y agoObviously, there are tremendous performance costs involved. Not only serialization, but also fan-in and then fan-out of concurrency on each end.
- nulltype 12y agoI don't think performance costs are that big of a deal in general. The real costs with those sorts of services is perhaps centralization and dependency on an outside entity. If we did manage to create some magical cross-language library (compile everything to C?) then maybe libraries would be back in style.
- pron 12y agoI don't know, at least on the JVM, libraries are very much in style. I know Google writes most large internal libraries in C++ with a C API and uses them from Java, Python, Go and C++.
- derefr 12y ago> but a description of the algorithm plus language-specific information that's supposed to help the particular platform execute the algorithm efficiently Tracing JITs should be able to spit out, as they run, the tables of Bayesian confidences they've built up for various static properties of the code, which can sit along with things like source maps, and be confirmed/rejected by the programmer in their IDE, or just live-reloaded into a new VM ala a Smalltalk image. (Future-tech, remember.) You can see the potential for this in things like Erlang's typer+dialyzer system. Likewise, static analysis tools should be able to work on foreign code after transpilation. There's nothing stopping you from transforming C code into Rust code in order to get the Rust compiler's opinion on its ownership semantics. Note that I'm not saying that there's one universal underlying language semantics. Just that language semantics (which consist of such things as a type system, a threading/memory model, etc.) have no reason to be tied to either a particular syntax, or a particular VM. (Effectively, a language semantics forms an abstract machine that executes more or less efficiently on the substrate of any given VM. MRI Ruby is a direct substrate for Ruby semantics; IronRuby is less-clear substrate; etc.) > those may significantly affect the suitability of an algorithm for a certain language This is a problem of transparent distribution. I've been working on an Elixir DSL for writing Haskell "inside" Elixir for efficiency. The result is not a Haskell compiled module getting linked into the Erlang VM, but rather a separate Erlang-VM-managed Haskell "application server" being run as a port program. I foresee much more of this, and much more cleverness about it: writing code that compiles to a bunch of separate modules for separate VMs, which then form a micro-distributed-system all within a Docker container or somesuch. Again, it's not about eliminating the plurality of runtimes—it's about rendering that plurality moot, abstracting it away from the perspective of the programmer and leaving it up to the implementation to decide how to optimize abstract-machine-to-VM allocation. There's no reason that you can't have every language semantics available to any library, to use in any combination (this parameterized type system with that green-threading and this other GC, etc.) It's just that, in so doing, you're either transparently importing into your single runtime some virtualization layers for all the other abstract machines you've coded in terms of (somewhat like writing a Windows app on Linux by linking it to Wine), or you've let the Sufficiently Smart Code-generator go beyond the premise of having a single target platform.
- 12y ago
- BuckRogers 12y ago"unless your new language/runtime is so revolutionary that it reduces development cost dramatically, fracturing the ecosystem is often too high a price to pay for merely a "nice" improvement. " I agree. Yet I do think both Rust and Go will probably end up meeting the standard. Go is a great alternative from a technical standpoint from Java. For a Python(2) user like myself, there's a lot of improvements but how easy it is to get started has replaced Python3 with Go for myself when I'm ready to move on someday. For me to make that judgement tells me boring old Go did simplicity as a feature correctly. Rust may also live up to the hype, but more for the C(++) usecases. Both Java and C++ were getting quite long in the tooth and I feel Go and Rust respectively offer enough to move away from the former two in time.
- pron 12y ago> Go is a great alternative from a technical standpoint from Java What? It doesn't require warmup -- that's why it's great for short command-line apps but other than that? It's slower than Java, doesn't have anywhere near the same level of deep monitoring, doesn't have any live code loading capabilities, and has really bad interoperation with other languages. I use it when I need a simple script to run faster than Python, but a Java replacement?? > Both Java and C++ were getting quite long in the tooth I don't know if you're aware, but OpenJDK's JVM is not only the most advanced runtime environment around by a longshot, but the one that's moving fastest with some really incredible research that's gradually finding its way into production. Even Google is putting more effort into improving OpenJDK than into Go. The JVM is much more modern (in terms of new code and concepts being integrated into it) than Go (whose runtime is almost primitive by comparison). Go is a great solution for that middleground between a script and a "heavyweight" application, but let's not compare its power to that of the JVM. It is a nice tool -- with excellent beginner friendliness -- but it doesn't offer any technical breakthroughs. As to Rust vs. C++ -- I'm hopeful, too, but like I said, there's no we can know how big its impact is until it's been used by several organizations in production for quite a few years yet.
- BuckRogers 12y ago" It's slower than Java, doesn't have anywhere near the same level of deep monitoring, doesn't have any live code loading capabilities, and has really bad interoperation with other languages. " Curious, what projects have you worked on where Go's runtime performance was slow, requiring a Java rewrite? Link to your scrapped repo or didn't happen. " I use it when I need a simple script to run faster than Python," Same thing, source to a situation where Python was too slow and it necessitated a Go rewrite for you? "OpenJDK's JVM is not only the most advanced runtime environment around by a longshot," Most advanced for memory usage? I'm not sure what your point is about being "advanced". MIT theory at it's worst. "but let's not compare its power to that of the JVM" Why not? JVMs are overengineered piles. Simple is better. "It (Go) is a nice tool -- with excellent beginner friendliness -- but it doesn't offer any technical breakthroughs." And thank Zeus it doesn't. I think I've had enough "technical breakthroughs" with OpenJDK's JVM, Node.js and whatever else is being sold today. Few are building new product on Java, other than those already entrenched. Android is the biggest draw and once Go is a 1st class citizen there, expect the life to be sucked out. Even with OpenJDK's JVM being the best thing since sliced bread.