Hacker News new | ask | show | jobs
by derefr 1949 days ago
I've always been surprised that nobody has tried to take a "The Good Parts" subset of a big language (C++, Perl, etc.), codified/formalized it as its own language, and then attempted to popularize the new reduced language as a distinct effort/project/community to that of the original language.

One could release this "language" as a distribution of the inner language's compiler together with a wrapper (like C++ originally was to C), that, rather than adding features and compiling down, just analyzes the source file and errors out on use of forbidden syntax; or, if no forbidden syntax is used, just passes your code straight through to the inner compiler. A bit like a pre-commit-hook style checker, but a pre-compile-hook style checker.

4 comments

For c++ there is orthodox c++ which is a subset of the larger language. Although as far as I know there is no linter/compiler. https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b
I just liked what is in Little, it's enough like C that it is trivial for me to jump into it (tcl always took a half a day, I really dislike the tcl syntax), it's got enough of the shortcuts from perl that it is pretty terse, and credit where credit is due, syntax aside, tcl has a bunch of useful stuff, check out Little's switch(), that's tcl's switch.
I have not tried to codify it yet, I think mainly because I'm still figuring it out, but I've been doing this with Perl and PHP, writing in a lowest-common-denominator style which is almost identical between the two...
Someone should do this with Nim.