6 ms·
> unless your language gets widespread adoption, you can corner your community into a bubble and drastically increase the barrier to contribution. Only if your
by loup-vaillant 8y ago
> unless your language gets widespread adoption, you can corner your community into a bubble and drastically increase the barrier to contribution.
Only if your language (and standard library) is of comparable complexity to that of widespread languages. C has more quirks than it lets on, C++ is a monstrously complex beast, Java has an enormous standard library…
If however you keep the syntax and semantics of your language simple, they can be learned in a matter of minutes. If you keep the "standard" library focused towards your application, it won't require more effort than any other regular application.
The real problem with custom languages, I think, is that very few programmers can actually write one. Most others don't even see the need, I think in part because of motivated cognition (If I delude myself into thinking I don't need something, I don't have to face the fact that I can't do it). Though the main problem is probably education: we are taught that languages are chosen, not made. As for how they are made… well, that's the realm of geniuses who have way too much time to spare.
Every programmer should have an introduction to programming languages, and we need more specialists who can whip up a DSL in a couple days. Our craft would be very different (and I think much better) if we did that.
- andy_ppp 8y agoElixir allows you to build powerful DSLs within the language using macros and optional syntax. Also, if you write CSS well you end up with a DSL describing your screens. What other languages give you this power?
- portroyal 8y agoThe Tool Command Language and Toolkit (Tcl/Tk).
- islon 8y agoAll Lisps and schemes?
- draegtun 8y agoWhat other languages give you this power? Rebol / Red NB. Here's an old Wikipedia link listing (some) languages that were good for creating dialects (DSLs) - https://web.archive.org/web/20140708161345/http://en.wikipedia.org/wiki/Dialecting https://web.archive.org/web/20140708161345/http://en.wikiped...
- timClicks 8y agoRed seems deeply underappreciated in my view. Any thoughts on why?
- draegtun 8y agoRed is still at alpha stage of development. I suspect once it reaches beta level then it main garner more appreciation.
- mises 8y agoWhen it last showed up here in HN, iI was very intrigued by it. However, it promises a lot of stuff I think many here have heard other projects make. It seems very ambitious. Documentation isn't the best, which makes it harder (especially due to different syntax). Overall though, I am still a little skeptical it can keep it's promises. (With that said, I hope it does: it looks like it has a lot of potential)
- register 8y agoIt's still an alpha language. I would never deploy something in production with it.
- tormeh 8y agoScala. For better or worse.
- eslaught 8y agoTerra [1]. I used it to create Regent [2] specifically because it takes this approach. [1]: http://terralang.org/ http://terralang.org/ [2]: http://regent-lang.org/ http://regent-lang.org/
- SomethingOrNot 8y agoYou’re affiliated with Stanford? If so, also with the developer of Terra?
- jaggederest 8y agoTo add to the chorus, most ML dialects, Forth, Ruby, Self, Smalltalk, Python, Mozart/Oz, D, Julia, Lua; to a significant extent Perl, PHP, Nemerle, Octave, R, Javascript, shell, even venerable old SNOBOL.
- p0nce 8y agoHence why making a new application-specific, general purpose language is probably not the greatest idea vs building a DSL within one of the languages you mentionned.
- fsloth 8y agoSimplicity is undervalued quality. It's far simpler from the point of view of dependency management, that if one is developing a large codebase in C++, to also have the scripting language be native to that environment, rather than to first create a DLL of the C++ codebase, then implement the FFI to it using e.g. SWIG, PINVOKE, or such, to call the C++ context from one of these "premade DLL" substrates. It's fairly trivial to expose C++ libraries to any other language context, IFF the library is wrapped to a DLL that respects the C ABI. The reverse is not true. You need to have some message passing mechanism in that case (yes, there are several not-so-hard ways to do that but that again, is added complexity).
- p0nce 8y ago> Simplicity is undervalued quality. Yes, and building a library (a DSL) in an existing powerful language that can do it (and there are many as people said in this thread) for exactly what you need, is _vastly_ simpler than making a new language toolchain (which linker? which codegen? which typing?).
- fsloth 8y agoI agree - choose the best tool for the job. As a counterpoint - Implementing an interpeted macro-less lisp is a few thousands of lines of code in C or C++. So if the goal is just to bootstrap some language, the effort is more about typing than design or innovation (just copy the interpreter in chapter 4.1 of Structure and interpretation of computer programs). A stack based language like forth would be even less work.
- chriswarbo 8y agoOOP is based, partly, around the idea of 'mini algebras' (roughly speaking, public interfaces), which are domain-specific languages ( http://xahlee.info/comp/Alan_Kay_on_object_oriented_programing.html http://xahlee.info/comp/Alan_Kay_on_object_oriented_programi... ) Functional programming, especially Haskell, tends to use the term 'embedded domain-specific language' ( http://wiki.c2.com/?EmbeddedDomainSpecificLanguage http://wiki.c2.com/?EmbeddedDomainSpecificLanguage ) Lisps tend to call them DSLs or sometimes "mini languages" Forth calls them "vocabularies"
- draegtun 8y agoI thought Lisps called them "dialects" (same as in Rebol / Red). Couple of other terms i've seen... * Pidgin - An attempt to get away from DSL ambiguity! * Slang - This is what Perl6 calls them
- chriswarbo 8y ago> I thought Lisps called them "dialects" (Lisp) "dialect" seems to refer to a particular implementation/variant of Lisp, e.g. CommonLisp, Scheme, Racket, Clojure, MacLisp, NewLisp, etc. rather than a domain-specific language built in a Lisp. (e.g. searching for "lisp dialect" gives pages like https://www.slant.co/topics/5928/~lisp-dialects https://www.slant.co/topics/5928/~lisp-dialects )
- mratsim 8y agoI've written several DSLs in Nim[1] for emulators & VM, JITs, parallel computing, neural networks and parallel tensor operations. [1]: https://nim-lang.org/ https://nim-lang.org/
- p0nce 8y agoD does that quite routinely too.
- p0nce 8y agoBut powerful languages of today let you build DSLs within them, so there is hardly a need to write a lexer/parser/semantics for a whole new language.
- loup-vaillant 8y agoThat would certainly be a good way to do it (though I reckon the limit between a mere library and an internal DSL is a bit fuzzy). Do you however have any widespread powerful language in mind? I don't know of any. Even all of them combined probably still doesn't count as "widespread". Also, once you understand the problem space well enough, a custom syntax can be a nice bonus.
- grumdan 8y agoI would say that Scala can be called widespread and allows for such embedded DSLs.