Warm tip: This article is reproduced from serverfault.com, please click

Is there a language that does both what SQL does and general purpose programming?

发布于 2020-11-27 23:48:26

I want to implement some game logic with a lot of relations between objects similar to those of relational databases or graph databases.

I know no language that would both allow me to do :

  • Strong, safe relationnal mapping with non nullable links, cascade deletion, ect.
  • Implement game logic
  • Write pure functions
  • Networking
  • If possible, a decent data access performance. (Like in-memory SQLlite is acceptable)

I want to avoid using 2 languages and map the data between both using some quite complex ORM. Instead I would like a language that is capable of all of these.

Obsiouly, there is SQL. But I do not know any implementation of SQL that :

  • Is capable of networking other than replying to SQL requests
  • Have the many features of a language like F# ? SQL is capable of functional programming but what about F# features like pipes, partial applications, pattern matching, strong typing over primitive types ?

I will accept partial alternative solutions.

Note that I do not need actual persistance storage, only objects relation like relationnal databases, or even graph databases do.

Questioner
Jul
Viewed
0
david.pfx 2020-11-29 15:40:23

The answer is no, within the bounds as you have set them.

The purpose of The Third Manifesto is to define a language called D, which has the features of a general purpose programming language but implements a type system and relational features specifically aimed at database management. If implemented fully it might replace SQL, but not common GP languages such as C/C++, Java or C#.

There are many GP languages which can do all the things you propose, when used in conjunction with suitably chosen libraries. For the closest match to what you describe, you should stick with any language that suits your other needs, and add to it an in-memory in-process database that uses an API and not SQL. Almost by definition that means you should look for a 'NoSQL' database. There are many.

You question was mentioned here: https://forum.thethirdmanifesto.com/forum/topic/is-there-a-language-that-does-both-what-sql-does-and-general-purpose-programming/. You might find subsequent discussion enlightening.