TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: JSONScript – Asynchronous scripting language using JSON format

49 pointsby epoberezkinabout 9 years ago

14 comments

prawnsaladabout 9 years ago
Feels very similar to JSON RPC.<p>This isn&#x27;t a script at all but a way to call an RPC method. And over a non duplex connection at that.<p>I often use something very similar with a few additions to support callbacks. Add an ID field so that responses can be matched and you suddenly support calls being made over a duplex connection such as Websocket or TCP connection;<p>Shorthand and longhand formats complicate things so stick with one type. The whole $ prefixed params are also un-needed, especially if your&#x27;e expecting them and have the important values under your own expected keys anyway.<p>But then after all this you start turning into json-rpc.
评论 #11747790 未加载
fallenshellabout 9 years ago
This exact concept has been done multiple times. And it never worked, because the syntax was horrible. And it&#x27;s just not convenient at all, it&#x27;s good for toying around with interpreters and the likes but it has no purpose or use. See <a href="https:&#x2F;&#x2F;m.reddit.com&#x2F;r&#x2F;coding&#x2F;comments&#x2F;3akmn1&#x2F;sums_this_rel_thing_up_pretty_well&#x2F;" rel="nofollow">https:&#x2F;&#x2F;m.reddit.com&#x2F;r&#x2F;coding&#x2F;comments&#x2F;3akmn1&#x2F;sums_this_rel_...</a>
评论 #11746652 未加载
ingenterabout 9 years ago
This reminds me of my multiple attempts in writing a declarative scrapper framework. In the end, I&#x27;ve chosen to just write the code.<p>What I see is a crappy ad-hoc scripting language. I feel bad saying so, but I can only view this project as a bad solution to whatever problem you have.<p>You could have chosen to send actual code, be it JavaScript, Python, Java or even Linux binaries, executed with limited privileges. How would that look like? AWS Lambda.
评论 #11746625 未加载
评论 #11746609 未加载
secoifabout 9 years ago
Why do many language home pages not show a single sample of the language?
评论 #11747718 未加载
评论 #11748131 未加载
NelsonMinarabout 9 years ago
Finally, a programming language that frees me from the possibility of writing comments!
评论 #11747737 未加载
评论 #11748225 未加载
tony-allanabout 9 years ago
I like the problem you are trying to solve and I like the idea of the JSON data structure but I am not so keen on the language as JSON. I find it hard to read, which would be worse in more complex real-world examples.<p>I guess I would like to see the code as plain text. Packaging all the data to send as JSON is OK, and the code could be text in a single JSON data element.<p>Post a story to Hacker News once you get some experience using JSONScript with some feedback on how you went and how the idea evolves.
评论 #11747867 未加载
alttababout 9 years ago
This technique never ends well. When your service interface is some untestible semi-script language your clients will hate you.<p>Nice work on building an interpreter, but I&#x27;d throw the entire SOA book at you for deploying this in a production environment. I haven&#x27;t even addressed stability, latency and load of programmable Web interfaces, or security.
评论 #11747834 未加载
评论 #11747766 未加载
epoberezkinabout 9 years ago
You can use it via the middleware for Express to implement advanced batch processing in a single line of code. <a href="https:&#x2F;&#x2F;github.com&#x2F;JSONScript&#x2F;jsonscript-express" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;JSONScript&#x2F;jsonscript-express</a>
macspoofingabout 9 years ago
I think it&#x27;s a cool proof of concept and you tried out a bunch of ideas that could work, but I don&#x27;t think you should use this approach for anything. JSON is not conducive for encapsulating complex logic, and it shows. Who is going to write and maintain that spaghetti code? Anyway, code execution at the datasource, is not a new problem, and there are approaches to solving it. Redis for example allows you to upload and execute Lua scripts at the source - way easier, way more readable, makes infinitely more sense. So why not use Lua or just use JavaScript - since your front-end code is all JavaScript anyway?
评论 #11746717 未加载
评论 #11746726 未加载
epoberezkinabout 9 years ago
Thanks for all the comments, some are really useful. JSONScript is an interesting experiment and the time will show whether it&#x27;s useful and whether we use it. What I find really interesting is why most higher level abstractions that reduce the amount of code to be written polarise normally friendly people to such extent, and &quot;just writing code&quot; is seen as the only &quot;sane&quot; choice. On the other hand, tools that increase the amount of code are usually very welcome. Any idea why it is happening?
评论 #11754040 未加载
jiyinyiyongabout 9 years ago
If you write it all in arrays, then you can reuse Cirru&#x27;s text syntax and would look shorter, hope you are interested: <a href="http:&#x2F;&#x2F;cirru.org" rel="nofollow">http:&#x2F;&#x2F;cirru.org</a>
评论 #11748800 未加载
woahabout 9 years ago
I know this thread is dead at this point, and any rational argument is probably lost on the author, epoberezkin, but this has made me think of BobX:<p><a href="http:&#x2F;&#x2F;thedailywtf.com&#x2F;articles&#x2F;Classic-WTF-We-Use-BobX" rel="nofollow">http:&#x2F;&#x2F;thedailywtf.com&#x2F;articles&#x2F;Classic-WTF-We-Use-BobX</a><p>The scariest part is that epoberezkin has mentioned using this new innovative language at his job. I hope someone stops him.
评论 #11805632 未加载
评论 #11749652 未加载
_nalplyabout 9 years ago
How to prevent Denial of Service? For example when a customer sends an infinite loop to the server?
评论 #11746103 未加载
epoberezkinabout 9 years ago
I&#x27;m working on it now. Any questions and feedback are very much appreciated.
评论 #11746738 未加载