Update to latest DWS in the works

My team always takes the beach first

Like I mentioned in the previous posts in Patreon (backers only), we have precious little tickets left! And I have started on the last big change, which is to update DWS (Delphi Web Script) to the absolute latest, bleeding edge version.

This brings us a number of advantages, most notable is the fancy new async and await keywords. So you will be able to define a procedure as purely async, and further define code that waits for that particular condition to finish or fail. The mechanism behind this is called a promise, which is a common JavaScript technology by now – implemented at the lowest levels of JSVM both for the browser and Node.js.

This will have a profound effect on how we write wrapper code for external libraries. At the moment we have to use a bit of inline javascript in ASM sections to pascalify these mechanisms — so it will be a great to finally be able to work directly with promises as a part of the pascal language.

A pseudo example is when downloading a file via the fetch() browser method:

await fetch(url, procedure (data: JByteArray)
begin
// Success code here, bytes in the data param
end,
procedure (error: JError)
begin
// Error handling here
end);

Timeframe

Since we forked DWS some 3 years ago, there have been a lot of internal changes to the compiler and infrastructure. This includes name changes that, while superficial, affects more or less every inch of the IDE code. I cant just do a mass-rename inside the source-code either, since there have been subtle changes in a few public elements that are now protected.

In short, this will take a week more to get to grips with — but it will be worth the wait!

Published by Jon Lennart Aasenden

Lead developer for Quartex Pascal

Leave a Reply