2 ms·
"But pretend you're writing the standard library internals for a new language['s reference implementation]—where do you start?" (Books by) Knuth? Cormen ? Ser
by plinkplonk 17y ago
"But pretend you're writing the standard library internals for a new language['s reference implementation]—where do you start?"
(Books by) Knuth? Cormen ?
Seriously though, if someone implementing "standard libraries" for a new programming language has to lookup implementations in some site-specific untested language, it doesn't bode well for the new language's future.
People who write such high impact libraries should be well versed in algorithmics, be able to (1) analyse and port pseudocode, (2)read and comprehend published papers (with mathematical proofs etc), (3) read comprehend and port existing implementations etc.
"I think the final goal, actually, would be to have an easy grammar spec that allows automated transformation of this particular code into a given language. That way, all languages, no matter the platform, can have the same core set of algorithm code."
Why not write an automated translator for(say) Java or C then? vs throwing yet another language into the mix.
Besides, this sounds too idealistic to me. But I guess seeing is believing. I'll believe it when I see a new language's implementor takes this path for a standard library.
I can't think of anyone good enough to write a robust, performant language interpreter/compiler and runtime balking at implementing algorithms and needing automated translation from a website.
- derefr 17y ago> I can't think of anyone good enough to write a robust, performant language interpreter/compiler and runtime balking at implementing algorithms and needing automated translation from a website. You're assuming we're talking about big, robust, powerful languages here. This wouldn't be for those, because those can survive without any help. We're talking about a long tail for language design: if you have an idea (say, Erlang's actor-model-as-core) and want to try it out, writing a standard library is a big barrier to putting out something satisfactory enough for "normal" programming that others will want to tinker on your language and help it grow. Imagine if Linus had to invent C when he was starting off with his tiny little prototype of Linux. We have rapid app development; why can't we have rapid language development?
- plinkplonk 17y ago"You're assuming we're talking about big, robust, powerful languages here." No I wasn't. I said " anyone good enough to write robust, performant language interpreter/compiler". I said nothing about the language size. Small langauges can be very powerful. You added the "big" adjective. "If you have an idea (say, Erlang's actor-model-as-core) and want to try it out, writing a standard library is a big barrier to putting out something satisfactory enough for "normal" programming that others will want to tinker on your language and help it grow. " And do you really think that a collection of random algorithms in an untested language on a website would solve this problem for them? The way to test out that idea would be to use an existing language (like Scheme,or C) to build the interpreter or compiler for the language you have in mind instantiating the specific programming model you have in mind, write an application or two in your new language, and write the minimum amount of libraries you need, not build a "standard" library by automatic translation from another language. In the meanwhile you use some kind of FFI to access the underlying language/OS libraries. (e.g arc using PLT Scheme's networking libs). Besides, the kind of algorithms a "standard library" has are not the ones built on the site (fibonacci and ceasar's cypher in a standard library)? A "standard library" has collections, os interfaces, guis, regexes, networking libraries and so on. I don't see those kind of algorithms being portable across languages not to mention paradigms. Or were you thinking that the new language would be a "small and simple" sequential object oriented language which is what the site's language seems to be? I quote from the site "Algorithmatic, by itself, is a small and simple dynamically typed Object Oriented programming language that serves as a common denominator among popular programming languages". Says who? How do you define "common denominator" among "popular programming languages" (like C, C++,Python, Java , C#, javascript, PHP, and Objective C)? I'd like to see a "common denominator" for such a language defined better. And assume you did design such a "common denominator", how would you go about automatically rewriting those algorithms to use an "erlang actor model"? As I understand automatically converting a sequential non referentially transparent program to a concurrent one is still a research topic. So your "erlang actor model" language won't necessaarily get any benefit from algorithms written in this site's language anyway. If I understand you right you are saying that someone designing languages (like PG is doing with arc) will now go and write some kind of automatic translator from this site-specific language to their own to get a "standard library"? I've never heard of any language designer anywhere ever doing that. It maybe that such things have happened and I haven't heard of it. Any real world examples (vs suppositions of what could happen in the future) you have of such an effort would contribute greatly to the discussion. I think (please correct me if I am wrong) that you are hypothesizing that such a thing might work vs having any successful real world examples of such an approach. I don't think there is a real problem language designers have that this site can solve. If you have any examples of a language designer creating a standard library for his language by writing a translator for algorithms written in another language and running that translator, please give citations. And if someone were (crazy enough to) to do something like this, I strongly suspect they would prefer to get some well tested algorithms written in the same language/paradigm "family" to "port" than some random collection of algorithms in a vaguely defined language on a random website. IOW even if a langauge designer were to create another dynamic object oriented language, he'd do better to attempt porting well tested and robust smalltalk libraries than from (a future version of) this site. As a thought experiment please imagine automatically converting smalltalk code to say Haskell, or Erlang. If that is too hard today why even bother with the silly algorithms on this site? And I am not sure an automatic translation would work even in that case. Unless the new language were an exact clone of smalltalk, this "automatic" translation would have so many places the designer would jump in and hand code stuff anyway, that it just wouldn't work out in practice. I would really appreciate any counter examples of a language designer actually building a standard library like you claim can be done.