FAQ - ThinEureka/asyn-script GitHub Wiki

Q: Will there be a text interpreter for this language?

A: No. The purpose of creating this language is to solve problems arising in C++. So it's intended to be a part of C++ code. Its real power comes from fact that it's highly integrated with C++ without the need to exporting interfaces. Pure C++ codes can be accessed effortlessly in the form of lamda expression, and the states of asyn-script virtual machines can also be easily accessed by pure C++ via the executable variable passed to the lamda expression. The codes can be edited and debugged along with pure C++ codes, which would be a very pleasant experience if you have ever used other scriting languages along with C++ code. It seems that the language features of asyn-script has become a part of C++ grammer, and you're just editing and debugging C++ with these new features in the same IDE. However, supporting a text interpreter can have its own benifits. The virtual machine already has the ability to call dynamically bound codes. It would be easy to write a text interpreter to convert text to a asyn-script functions. But in that case, whatever the text would be like, it's no longer asyn-script. It's just a new language that shares the same virtual machine with asyn-script. The grammer and syntax of the new language is totally up to the implementer. So it's likely that when needs arise I will create a text interpreter. In that case, I need to build tools to debug the new scripts or I only accept the scripts for simple use thus save the needs to build a powerful debug tool.

Q: What can be done with the verbosity of asyn-script syntax ?

A: A full-featured IDE can provide enough code hints. Besides that, the Insert-code-snippets function of some IDE and plugins like Visual Assist can boost coding efficiency when you make the frequent used asyn-script code-snippets as templates and assign shortcuts to them. For example, you can create a code-snippet in Visual Assist as following, and set "if" as its shortcut.

f->IF(condition)_
{
}f->ELSE()_
{
}f->END_IF()_;

So when you type "if" in the code editor next time, the plugin will help you insert the codes with less efforts. The same thing can be done with other code-snippets as well.

The DO function call is the basic building block of asyn-script code.

f->DO([this](asys::Executable* executable){
   //type in C++ code here.
})_;

And the code snippet of creating a asyn-function with pseudo-C++ syntax.

auto& f = m_asynFunctions[__FUNCTION__];
if (f) return f;

f = new asys::FunctionCode();
{
  f->INPUT({param0, param1})_;
}

return f;

The language is evolving as well, some facilities have been added to it to make coding asyn-script easier, and a versatile syntax for supporting compound expressions is under consideration. I can't see where all these efforts finally will lead to. But I'm sure that this language has become easier to use and more powerful than when it was created.