5 ms·
If you’re thinking of writing a language in earnest, you will create something much more valuable if you start from a novel semantics, and only then come up wit
by evincarofautumn 12y ago
If you’re thinking of writing a language in earnest, you will create something much more valuable if you start from a novel semantics, and only then come up with a syntax to express those semantics, than if you were to start from syntax.
The world does not need yet another reskin of Java, but it could use new programming paradigms and new ways of solving problems.
As a learning exercise, implementing a language is worthwhile simply to gain the understanding that languages are not magic. To boot, you’ll pick up loads of useful techniques in the realms of parsing, data flow analysis, error reporting, and optimisation.
- mamcx 12y agoAgree. I'm (trying!) to do one, and now I only focused in the AST and trying to build the features. Is a waste of effort to rewrite parser/lexers/etc if the core is in constant change: https://www.reddit.com/r/coding/comments/2ocw2r/how_to_create_a_programming_language/cmy792d?context=3 https://www.reddit.com/r/coding/comments/2ocw2r/how_to_creat...
- nostrademons 12y agoIf you're looking to build something that people will actually use, you're better off not doing anything novel at all, but rather combining novel ideas that have shown promise in research languages into a package that people might actually want to use for everyday programming. There's a rule of thumb among language designers that your language should either focus on proving out one big language feature, or it should introduce zero new language features but combine new language features from a number of other languages. So for example: Erlang introduced lightweight CSP-based concurrency. Go popularized it. Haskell introduced typeclasses. Go and Rust popularize them (as interfaces and traits, respectively, the latter also influenced by C++ STL's concepts). Cyclone introduced linear types. Rust popularizes them. Smalltalk introduced object-orientation. (More precisely, Simula did and Smalltalk took it to its logical conclusion.) Java, C++, and Objective-C popularized it. Self introduced prototype-based programming. Javascript popularized it. CLOS (Common Lisp) introduced the meta-object protocol. Python and Ruby popularized it, particularly in their Django and Rails web frameworks respectively. Usually popularizing a language involves a good deal of work that's not sexy, notably building up a large standard library, developer tools, a package manager, and a whole ecosystem around the language.
- seanmcdirmid 12y ago> There's a rule of thumb among language designers that your language should either focus on proving out one big language feature, or it should introduce zero new language features but combine new language features from a number of other languages. This rule doesn't exist among language designers, at least the ones I hang out with. You'll find a mix of innovation and invention in most programming languages.
- felixgallo 12y agoerlang's concurrency is actors, which is different from go's CSP. And I nearly spat out my tea when you said that Go popularized something Haskell did; and I haven't even had any tea today.
- codygman 12y agoBut didn't Go effectively popularize typeclasses through interfaces?
- felixgallo 12y agono?
- codygman 12y agoCan you explain how? Obviously at least two people either disagree or aren't privy to the knowledge you hold!
- RodgerTheGreat 12y agoIndeed. Recently I was inspired to learn K, a language in the APL family. There aren't many implementations available, so I wrote my own. Doing this forced me to come to terms with a whole range of features I might have otherwise shied away from using.
- bazookajoes 12y agoHi! Is your implementation available for use? I'm curious - how did you test it for compatibility with the main K implementation?
- RodgerTheGreat 12y agoSure, here's the repository: https://github.com/JohnEarnest/ok https://github.com/JohnEarnest/ok I don't have a rigorous approach for testing compatibility at present; My starting point was the K2 manual, and I've tried to get as many examples from that working as possible. I have been learning the language as I go, so often I don't realize functionality is missing until I stumble across an existing K program that doesn't work properly. I'm targeting K5, which is unreleased, so there's a great deal of speculation. I think I have a decent subset of the functionality working now, but most of the time when I write new programs using it I still shake out bugs and unhandled edge cases.
- srpeck 12y agoAwesome. I started building a toy C interpreter to the k5 spec (http://kparc.com/k.txt http://kparc.com/k.txt) based on the k4 data structures (http://kx.com/q/c/c/k.h http://kx.com/q/c/c/k.h) and documentation (http://code.kx.com/wiki/Cookbook/InterfacingWithC http://code.kx.com/wiki/Cookbook/InterfacingWithC). That k2 manual is a good find.
- RodgerTheGreat 12y agoCool! Nice to know that I'm not the only person trying to implement K5 from scraps and speculation.
- weavie 12y agoI wrote a language once where functions were not allowed to return values. All you could do was pass a continuation that could handle the results of that function. Totally impractical language, but it was fun and did force me to think out of the box.