Jump to content
David Schwartz

new async lib TMS is pulling into their ecosystem

Recommended Posts

NOTE: I'm not sure if this best fits into Network, Cloud and Web area or the Cross-platform area, as it seems to span both.

 

A while back before I started working with WEB Core, I asked some questions here about how to work with threads to synchronize calls to APIs. They created a lot of noise, in part I think because there are several different multi-threading libs and idioms that offer a variety of features and benefits that fit some needs better than others.

 

WEB Core came out shortly after that and I started playing with it. They take Dephi code and run it through pas2js to transpile it into javascript. They were able to modify the input language slightly to make it easier to map code into common js idioms, by providing an [async] attribute and an await(...) method. There's also an async; tag that can be placed in certain places after a method definition. 

 

I've been working with this stuff for quite a while now, and I often forget to use one or the other of the above annotations correctly. It doesn't help that the compiler does a poor job of keeping attributes attached to the lines they affect in the class headers, which causes other headaches. 

 

I wrote something last year that is a multi-step process that involved a ton of API calls in each step. Although the idea was to make much of it run in parallel, the syntax requirements and sync dependencies made it quite messy to accomplish. Maintaining it got to be a nightmare. 

 

However, TMS just announced that they are incorporating a fairly new open-source async library into their stuff that appears to solve a lot of the complexity issues I ran into -- and I bet a lot of folks who don't use TMS products for this have as well, since it addresses a quite generic problem. Here's the post in their blog where they announced it:

 

https://www.tmssoftware.com/site/blog.asp?post=1296

 

There are links in that article where you can find the original source code (on github) where the docs and code libs are found.

 

This approach does not require any changes to the language, yet offers a clear and fairly simple approach to dealing with the async nature of remote APIs without undue burden on having to manage tons of threads. TMS has retrofitted it into one of their FNC libs (the FNC Cloud Pack) that can be referred to for your reading pleasure, and it looks like they might be expanding it to other libs as well.

 

The point is, this library is written for Dephi and is fully independent on any of TMS' own tools. It might be worth looking at if you work with code that's a lot more convoluted than you like due to the need to synchronize a lot of calls to external APIs and services. I haven't had a chance to do anything with it other than read through the documentation; but after the nightmares I had from the sync-related code I was working on last year, this lib looks quite promising. I can see why TMS likely chose to adopt it -- not just for new code, but they're even making a considerable effort to retrofit it into their exising packages, which isn't something that's ever done without quite a bit of close scrutiny.

 

 

 

Edited by David Schwartz
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×