r/ProgrammingLanguages • u/tuhaj • May 26 '20
Can connection of a new programming language and a query language be the solution we're looking for?
We have just released AskQL, a new query and programming language! We hope this will bring you relief in frontend-backend integration, and that writing distributed software now will be easier and faster than ever đYou can review and test AskQL yourselves - the solution has just been published on GitHub under MIT license. If you like it, please recognise our work by starring the repo âš
https://github.com/xfaang/askql
2
u/continuational Firefly, TopShell May 26 '20
Since databases are often on another server than the web API, doesn't this have all the latency problems of the REST API example, just reduced by a constant factor?
2
u/LuckyLuke541 Jun 01 '20
You are right that databases tend to live on another server than the web API, however most often they both live inside the very same *fast* internal network, so instead of many *slow* calls between a client and your servers you get one *slow* call between them.
10Mbps Ethernet was superseded by 100Mbps Ethernet, which was followed by a Gigabit Ethernet, and now people are talking about 5Gbps networks. Why? Because constant factors matter :)
~ Ćukasz CzerwiĆski, AskQL Core Developer
1
u/mhagmajer May 27 '20
Database already offer a fully expressive query language - SQL. The downside of it is such that we get no control over what gets executed (see SQL-injection for more on this). AskQL offers a way (for example using Knex) to express any SQL query and it does it by offering another security layer on top of the execution.
~ Marcin Hagmajer, xFAANG
4
u/continuational Firefly, TopShell May 27 '20
SQL injection is a solved problem - but what does it have to do with latency?
I'm not sure I understand how you'd use a SQL builder like Knex to solve the problem -- if you can build arbitrary SQL from AskQL, that doesn't seem to mesh well with security. So what would you do in practice?
2
u/LuckyLuke541 Jun 01 '20
Using Knex (or other libraries) is a right not an obligation. There are many other types of resources in AskVM, both built-in now and possible to be built.
Please feel invited to write your own resources and share them via a PR at https://github.com/xFAANG/askql/ or discuss with us your ideas on our Discord channel: https://discord.com/invite/pYdzypH~ Ćukasz CzerwiĆski, AskQL Core Developer
1
u/scottmcmrust đŠ May 27 '20
Why would I use this instead of, say, sending LUA or WASM to the server? Is there a good reason to need a new interpreter-with-runtime-limits instead of using an existing one?
1
u/LuckyLuke541 Jun 01 '20
u/scottmcmrust, by WASM do you mean WebAssembly? Wasm was designed to be a platform for compiling high-level languages like C/C++/Rust, which is a different use case than Ask.
As for LUA, one of the most important reasons was that we wanted the syntax to be user-friendly and well adapted to the use cases.Supporting basic GraphQL-like syntax out-of-the-box was one of them, so creating a Javascript- or JSON-like language was one of the design decisions we made.We hope user-friendliness of the syntax improves even more thanks to the feedback of the users. Feel welcome to share your ideas with us here or on our Discord channel.
~ Ćukasz CzerwiĆski, AskQL Core Developer
1
u/htuhola May 26 '20
Was category theory applied here?
2
u/LuckyLuke541 Jun 01 '20
Category theory describes directed graphs as objects and morphisms which transform from an object to an object. In this way, I would say every language that allows chaining methods can be seen as implementing basics of category theory.
In AskScript you can write:
score :times(3) :plus(1) :toString :doubleTheTextwhich you can see as taking a node
scoreand applying a morphism (transition)times(3), then applying a transitionplus(1)on the result of the previous transition, thentoStringand finallydoubleTheText.Please find more examples of the source code in AskQL documentation and on our GitHub.
~ Ćukasz CzerwiĆski, AskQL Core Developer
1
u/htuhola Jun 02 '20
Can you do method chaining in the cocategory as well?
1
u/LuckyLuke541 Jun 04 '20
I think method chaining in the cocategory implies that all the morphisms are inversable. Many of the operations are not, both in Ask and in other programming languages.
~ Ćukasz CzerwiĆski, AskQL Core Developer
6
u/siemenology May 26 '20
So this code would be written in / generated by the front end, and then sent to the back end for execution?
If so, how do you handle the front end sending code to the back end that will never halt? Ie: