开发者

New or not so well-known paradigms, syntax features and behaviours of programming languages?

开发者 https://www.devze.com 2022-12-27 10:44 出处:网络
I\'ve designed some educational programming languages and interpreters for them, but my problem always was that they ended up \"normal\" and \"boring\", mostly similar to some kind of existing languag

I've designed some educational programming languages and interpreters for them, but my problem always was that they ended up "normal" and "boring", mostly similar to some kind of existing language (ASM and BASIC).

I find it really hard to come up with new ideas for syntax features, "neat things" and new or very modified programming paradigms for it. I always thought that it was hard to come up with good new things not fun/useless new things for this case.

I wondered if you could help me out with your creativity:

  • What features in terms of language syn开发者_Python百科tax and built-in functions as well as maybe even new paradigms can I work into my language to keep it useless but more fun, enjoyable, interesting and/or different to program in?


I always thought that it was hard to come up with good new things

You were right. This is why John Backus, Ken Iverson, Niklaus Wirth, Robin Milner, Kristen Nygaard and Ole-Johan Dahl, Alan Kay, and Barbara Liskov all won Turing Awards—they contributed good new ideas to the design of programming languages.

If you want to add a dash of interest to your own designs, these are excellent people to steal from.


Both ASM and BASIC are imperative languages, so you might want to consider features of functional programming languages, especially lambdas and maps. You might also want to consider interesting flows of control, for example, being able to throw an exception and then later, as a result of catching the exception and making a certain call, resume from the point that the exception was thrown (albeit using a modified environment). Also, co-routines, or other forms of language-level parallelism are often interesting.


In addition to Michael's comment on functional languages, look at closures and blocks (like they're done in Objective-C). Those let you treat functions or pieces of code as first-class objects that you can pass around and call on demand. Some cool stuff can be done with that, and it's also shaping up to becoming the paradigm for programming massively multi-core systems.

You could also look into currying, which means binding some of a function's parameters, so you can then use it on fewer arguments. That way, you could create a base-b logarithm function, which you could curry to create functions for the base-2, base-10, etc. logarithm.

And something less functional (as in language): look at Ruby's way of treating everything as an object (even numbers), you can do quite a bit with that. Like an object-oriented runtime with introspection, an interpreter "for free," etc. Implementing OOP stuff is easier than you'd think.

A lot of stuff has been done in the last 30-odd years, don't restrict yourself to 70s-style programming! ;) If you're looking for inspiration, check out Ruby, Python, Scala, Objective-C, JavaScript (read Douglas Crockford's JavaScript: The Good Parts), etc.


The Esolang wiki gives a good sample of the weirds and wonderfuls of all kinds of esoteric programming languages, including many user creations. Perhaps some inspiration for something sane lies therein.


look at Forth. It is something original. Too original.


intercal has plenty of unusual language features B-)


I've always thought it would be neat to apply CSP to a stack based language. Could get pretty interesting.


See Wikipedia: Programming Languages. There are many useful links, especially in the Taxonomies section.

So much of the "new" is really just "forgotten old". I will hold my thoughts on some of the "popular" programming languages of the day.


There are many things that could be explored and active research is being done on some of them. Some of the things I think would be useful are:

  • real continuations in a non-functional language
    • here is an attempt to add them on to C++: http://mainisusuallyafunction.blogspot.co.nz/2012/02/continuations-in-c-with-fork.html
  • languages that let the user create new syntax elements
    • FORTH and J might be starting points.
    • Pogoscript is interesting as well because flow control constructs like if/elseif/else and while/wend arten't special can be created in user code.
    • custom user defined operators actually aren't new: I think Haskell, Nemerle, Kaleidoscope and several others already do this but even that wouldn't be "boring"
0

精彩评论

暂无评论...
验证码 换一张
取 消