Vous êtes sur la page 1sur 62

AngelScript To-Do’s 

Items marked with (priority) are currently being prioritized for the upcoming releases.
Items marked as (unplanned) will probably never bety implemented.

   
Improve manual 
Explain better how to use weakref from C++ - 2014/12/01 
http://www.angelcode.com/angelscript/sdk/docs/manual/doc_addon_weakref.html

asIScriptObject *my_obj = 0;
asILockableSharedBool *my_obj_isDead = 0;

void set_event(asIScriptObject *obj)


{
my_obj = obj;

// Get the weakref flag for the object so we can check if it is still alive before accessing it
my_obj_isDead = engine->GetWeakRefFlagOfScriptObject(obj, obj->GetObjectType());
my_obj_isDead->AddRef();

// Release the object handle we received from the script so we don't keep the object alive
obj->Release();
}

void do_something()
{
// Before accessing the stored object, verify that it is still alive
if( my_obj_isDead->Get() )
return;

// The object is still alive, now we can do something with it


...
}

Better explain how type conversion involving bool works - 2014/11/13 


http://www.gamedev.net/topic/662813-opconv-and-opimplconv-with-bool/

Explain why the asBEHAVE_VALUE_CAST doesn't allow casts to bool.

Explain how to work with common C++ types - 2014/08/18 


The documentation need an article on how to deal with common C++ types that are not suitable
for the automatic memory management in AngelScript.

- char *
- std::vector / std::list
How to register std::function - 2014/07/10 
Add example in documentation for how to register std::function

http://www.gamedev.net/topic/658633-registering-a-stdfunction/

Improved documentation - <2014/12/31 


Some suggestions for improved documentation:

● Show an example factory function for ​template objects


● Case study 2: using global script functions to implement the controllers
● Case study 3: implementing animation with co-routine
● Why use scripts: explain my view on why use scripting : safety, easily modified, remote
debugging, etc
● Write page on c++ smart pointers
● Write an article on 'hot loading', i.e. recompiling scripts for already existing objects.
● Write a trouble shooting page in the manual that tries to explain what needs to be
investigated when specific errors occur. For example, when the error Invalid
Configuration is seen the developer must go back and verify all calls to registrations for
failures.
● Improve manual on variable argument type
● Improve manual to better describe when to use @, &in, &, etc

Compare AngelScript and C++ language - 2015/07/12 


Write an article in the manual that compares things that are done slightly differently in
AngelScript compared to C++. For example:
● allocating a dynamic object, then freeing it
● declaring a function that returns objects in out parameters
● arrays
● classes, interfaces, and multiple inheritance
This article should be a complement to the existing ​Datatypes in AngelScript and C++

(priority) Context pool clarification - 2015/09/02 


http://www.gamedev.net/topic/671469-requestcontext-returncontext-question/
Update the manual page for the asIScriptContext to reference the context pool example in the
fine tuning page.

Provide better introductory article for newcomers - 2016/01/02 


Those who currently don’t know about AngelScript but wants to get a quick understanding of its
capabilities do not want to have to read through a thick manual. For these people a quick
introductory article is needed, perhaps a more elaborate tutorial.
Also, it would be good to be able to provide a pdf of the manual. For those who like to do quick
browsing through the manual.

(priority) Inform about value types with self reference in function 


arguments - 2016/03/29 
http://www.gamedev.net/topic/646508-weird-string-crash/

Make sure the manual explains why it is currently not possible to have function take object types
by value if the types include a self reference (which would be invalid when the object is
moved/copied byte-for-byte from the context’s stack to the application’s stack inside the code to
support native calling conventions).

Write article on sandboxing - 2017/01/31 


- what does it mean to say 'sand-boxing'? (scripts should not be able to break the application no matter what)
- under what circumstances can scripts in AngelScript be considered 'sand-boxed'?
- application must not allow multi-threaded scripts (though co-routines are safe)
- application must only register safe types and functions
- registered value types must not allow self modification, except with the assignment operators.
- methods on value types must not be allowed to return reference to itself
- application must not turn on the allow unsafe references engine property

(priority) Write article on the script calling convention - 2018/02/19 


The article should explain how arguments are passed to functions in each situation. When the
value of an argument is copied, and why. Who is responsible for clean-up and ref counting
(caller or callee).

This article is meant for script writers who wishes to have better understanding of how the
language works to better optimize the script code, and also for application developers who
wishes to customize the library.
Compiler messages 
Improve compiler error message #1 - 2012/01/02 
funcdef void OnActionCB();
OnActionCB @actionCb;

void onActionF() { }

void addAction(OnActionCB @a) {


actionCb = a; // in this line builder detect error.
startActionChecker();
}

void main() {
addAction(@onActionF);
}

The error message that was generated in the above example was “There is no copy operator for
the type '_builtin_function_' available."

A better message would be something like “Cannot do a value assign for function handle. Did
you forget @?”. Or something similar.

Reported by Andris Jaunzeikars

Improve compiler error message #2 - 2010/03/05 


When a global variable fails to initialize for some reason there is no appropriate error message.
The compiler/module should at least write the name of the variable that fails to initialize.

An example error is when the constructor for an object refers to a global variable, but that other
global variable has not been initialized when this constructor is called.

Reported by Philip Bennefall

Improve compiler error message #3 - 2014/02/10 


http://www.gamedev.net/topic/653224-multiple-object-arguments-problem/

Parser gives a slightly cryptic error message when the argument name in the arglist uses a
reserved keyword instead of an identifier.
Improve compiler error message #4 - 2015/02/02 
Improve error message, when trying to pass function pointer to function but the signature
doesn't match the expected funcdef.

http://www.gamedev.net/topic/664944-stack-corruption-when-using-funcdef-and-class-property/

Improve compiler error message #5 - 2014/12/13 


Give better error message when trying to call non-const method on const handle. Maybe
something like "No matching methods to 'XXX'", "A matching non-const method exists, but
cannot be used because the object is read-only"

http://www.gamedev.net/topic/663696-bug-in-type-casting/

Improve compiler error message #6 - 2014/07/13 


Error message on non-terminated string constant needs improvement:

http://www.gamedev.net/topic/658737-line-numbers-for-non-terminated-string-literal/

Improve compiler error message #7 - 2018/01/21 


https://www.gamedev.net/forums/topic/694703-segmentation-fault-with-dictionary-retrieve-to-aut
o/

The error message ‘No appropriate opEquals method found’ should also inform which types are
being compared to make it easier for the user to understand why the opEquals method cannot
be found.

Improve compiler warning #1 - 2014/10/29 


Add warning when calling a class method that has the same name as a global function, as it is
otherwise too easy to call the wrong one by mistake.

void func() {}
class A {
void func() {}
void test() {
func(); // which function did the programmer really want to call
here?
}
}

It has to be possible to work around the warning by explicitly mentioning which one is called,
e.g.
::func(); // for calling the global function
this.func(); // for calling the class method

Reported by Aaron Baker

Improve compiler warning #2 - 2014/09/14 


class Base
{
void foo() {}
void bar() {}
}

class Derived : Base


{
void foo(int) {} // the compiler should warn that this creates
// an additional overload, rather than overriding
void bar() {} // the compiler should warn that bar is overriding
// the base class' method
}

class Derived2 : Base


{
void foo(int) overload {} // no compiler warning, since it is explicit
// that it is intentionally an extra overload
void bar() override {} // no compiler warning, since it is explicit
// that it is intentionally an override
}

This is different from C++. In C++ the base class' methods are hidden when the Derived class
declared any method of the same name.

http://stackoverflow.com/questions/1628768/why-does-an-overridden-function-in-the-derived-cla
ss-hide-other-overloads-of-the

Option to disable specific warning messages - 2014/10/29 


Each warning message should have a specific number. It should then be possible to tell the
engine to disable/enable specific warnings using this number.

Compiler messages - 2012/06/04 


● Improve error message when declaring a variable as only statement of an if/else/for, etc
● Compiler alert for expressions that don't do anything
● AngelScript should warn if trying to read from &out parameters before they have been
initialized. Similarly to how it warns about uninitialized local variables.
● Compiler can warn if a class member or local variable hides a variable in a higher scope.
● Compiler can warn in class constructor if class member is used before it is initialized.
● Compiler can warn if constructor finishes without initializing all members.
Compiler should warn if an object is constructed without being used for anything. Example:

void Func()
{
Object(); // Warn here as the created object is not used
}

void Func()
{
Object a(); // Don't warn, it is assumed the object was meant to
be created
}

The error message for invalid use of registered properties in switch cases is misleading and
needs to be improved.

// C++
RegisterGlobalProperty("const int val", &val);

// AS
switch( expr )
{
case val: // wrong, val is not a true literal constant
break;
}

Warn when global entity has same name as enum value - 2015/10/23 
enum tiles
{
wall,
grass,
gravel,
sand
}
void wall()
{
// do something.
}
void main()
{
wall();
int current_tile = wall; // This only sees the function
}

Reported by Aaron Baker by e-mail.

I need to look into how to best handle this situation. Perhaps the compiler should require the
scope operator to be used, even for the function due to the ambiguous interpretation? Or
perhaps the compiler should warn that the enum value has the same name as a global entity
when it is declared?

When the engine property ​asEP_REQUIRE_ENUM_SCOPE​ is used the ambiguity doesn’t exist
as then the script writer is required to prefix the enum values with the enum type anyway, i.e.
tiles::wall​.

Error when passing incorrect class method to delegate - 2015/11/01 


http://www.gamedev.net/topic/672895-funcdef-error-message-when-using-delegate/

The error message in the situation reported by Solokiller needs to be improved to better show
that the class method doesn’t match the signature for the funcdef used to create the delegate.

Warn when not informing ‘override’ for method that overrides parent 
method - 2016/02/22 
http://www.gamedev.net/topic/676214-warn-about-overriding-functions-without-override-keywor
d/

For this I should study better how things work in other languages (C++, C#, Java, D), so I do not
end up doing something totally different.

I should probably also enhance the warning system so that the application developers can more
easily decide which warnings they want to see, and which not.

Warn when @ is used needlessly - 2016/07/30 


http://www.gamedev.net/topic/680611-passing-this-as-argument-in/

@h.method(); should warn since the expression is not really using the address of whatever is
returned by method().

@h.prop should also warn if the expression isn't using the address for prop.

   
Library 
(priority) Remove the asBC_SUSPEND instruction - 2017/02/16 
The asBC_SUSPEND instruction was included since the beginning to have a marker in the
bytecode where the VM can be safely interrupted. It is normally included at every line, or at least
once per loop so that there is always at least one such instruction in the code to allow even
badly written code with infinite loops to be interrupted.

It may be possible to remove the asBC_SUSPEND instruction completely from the code.
Instead the places where the VM can be safely interrupted should be stored as a separate list of
positions.

With this the VM execution speed won’t have the overhead of processing the asBC_SUSPEND
instructions anymore.

To still allow infinite loops to be interrupted JMP and CALL instructions can be changed to allow
the script to interrupt.

To still allow debugger to step through the code statement by statement, the VM can prepare a
temporary array of bytecode that will be executed instead of the original bytecode. In the
temporary array the VM only includes the instructions for the current statement so it ends when
the statement finishes. The debugger will of course become much slower this way, but the
normal execution will be faster.

Order initialization of global variables by dependency - 2017/02/15 


https://www.gamedev.net/topic/686466-odd-behavior-when-using-globals/

The compiler should do a deep scan of the bytecode used in the initialization of global variables
to verify all other globals accessed and then order the initialization accordingly.

It will not always be able to determine the order. For example a function can be accessing two
different global variables in different conditions. In this case the compiler will see both, even
though during initialization only one of those are actually accessed.

It will probably be necessary to have some manual way of ordering the initializations when
absolutely necessary. Perhaps some specific tag like:

after a:
int b = a;
before b:
int a = 42;
Food for thought: ​perhaps this could be used to allow global statements too. One of the reasons
for not allowing global statements is exactly due to the difficulty in determining precise order of
execution, especially when involving multiple script sections in the module.

Disable use of floats in scripts through engine property - 2016/05/14 


http://www.gamedev.net/topic/678563-as-and-determinism/

By disabling the floats through an engine property, the compiler will be able to give appropriate
error messages if the script writer attempts to use floats, unaware of the fact that they have
been disabled by the application.

Static code analyzer Coverity - 2015/10/09 


https://scan.coverity.com/

Use Coverity to do a static code analysis on the code in the library.

Tip by Dominique Dumont.

Add validation in registration - 2015/09/12 


http://www.gamedev.net/topic/671705-bug-with-registered-properties-and-property-accessors/

Change generic calling convention - 2015/04/21 


The generic calling convention must behave identically to the native calling convention with
regards to how reference counting works. This includes making the generic calling convention
support auto-handles.

The reason for this is that it should be as transparent as possible to choose between native
calling convention and auto-wrappers.

As this will break backwards compatibility I need to think how to avoid impacting unsuspecting
developers. Perhaps I’ll wait until starting version 3.0.0. Or perhaps I’ll create a
asCALL_GENERIC2.

This change should also preferably be done together with the change to have all object handles
owned by the caller instead of the callee (to-do already mentioned on the AngelScript WIP
page),

Optimization - Compile to intermediate code - 2015/04/14 


If the compiler compiles to an intermediate bytecode instead of the directly to the final bytecode,
it may be possible to use local optimizations for better runtime performance.

For example, the intermediate bytecode may have the instruction asBC_CALL for calling a
function. But after the local optimization this bytecode is exchanged for
asBC_CALL_WITH_CDECL, asBC_CALL_WITH_GENERIC, asBC_CALL_WITH_THISCALL,
etc depending on the calling convention of the registered function.

Of course, the saved bytecode would be on the intermediate bytecode, so after the final step
has been performed and the intermediate bytecode is removed it would no longer be possible to
save the bytecode.

Optimization - Function inlining - 2014/09/24 


http://www.gamedev.net/topic/661308-function-method-inlining/

Alternate memory management - 2015/02/10 


If the script engine's custom memory allocation routines are changes to separate data
allocations (script classes, etc) from code allocations (script functions, etc). It would potentially
be possible to allow the application to setup a limited data memory block that can be used by
the scripts. Objects allocated in this block can then skip reference counting all together and
instead the application might be able to simply free the entire block at once when the scripts are
completed.

The separation of data and code is interesting, but there are some questions that needs to be
answered:

- how should the context stack be considered? is it a data or code memory block?
- how should reference counting into code objects, e.g. the object type, be handled? If the entire
block is freed without calling the object's destructors it is possible that the code objects won't
have their external ref count reach 0, thus cannot be destroyed by the engine.
- how to deal with pointers into the data memory pool from outside the pool, e.g. the application,
or from the global variables in the scripts?

Reduce memory usage - Share the function signature - 2013/01/22 


The idea is to share things that are often similar between functions, such as the actual signature
(return type, argument list, system interface, etc). Only things that are not shared should be
individual to each function (name, namespace, function pointer, bytecode, etc).

The actual function signature would be stored in a vector with a hash-key for quick comparison.
And the asCScriptFunction would refer to the signature object.

With around 100 functions with a simple signature of ‘void f(void)’ perhaps around 10KB of
memory would be saved.

Reported by Jason Dorie (Visual Concepts) by e-mail


Float operations with NaN - 2015/01/03 
Look into operations with float NaN. They are probably not properly handled in AngelScript.
Comparison for example should always return false (except for !=, that should return true).

http://www.gamedev.net/topic/664275-angelscript-operators/

Hacker safety - Symbol obfuscation - 2013/03/15 


As the script code is stored in memory with names of functions and variables in clear text it can
be quite easy for hackers to do a memory dump and find relevant pieces of memory to modify in
order to cheat/hack games.

If the symbol names are obfuscated, preferably through an application registered callback, it will
be less obvious where things are stored in memory.

Reported by Philip Bennefall by e-mail

Compiler callback for function calls - 2014/08/18 


Better error message when trying to create script object without default constructor

http://www.gamedev.net/topic/660038-failure-in-createscriptobject-when-adding-class-instance-t
o-dictionary/

Possibly addition of compiler callback for validating function calls with variable argument. That
would be the only way I could catch above error at compile time rather than runtime.

Should the callback be global? Or should I have a callback for each registered function?
Callback must be called when loading bytecode too.

2016/09/01​ - Another case where compiler callback for function calls is useful is for template
types where the template type may call a method on a script class. With a compiler callback the
template type can check at compile time if the script class actually implements the expected
method, instead of just throwing an error at run-time.

http://www.gamedev.net/topic/681790-problem-in-arrayinterface/

Exposing char* to script - 2015/06/15 


A common way of exposing char* to script is to register a POD value type as charptr, and then
implement a opImplConv for the string type.

The biggest problem with this is that the application has no control over what pointers exist to
the char buffers, thus it cannot easily determine the lifetime of a particular buffer. This in turn
can lead to buffers being overwritten at inconvenient times.
Consider a C++ function that takes two char*, e.g. strcmp(const char*, const char*). It might be
registered with the script as “strcmp(charptr, charptr)”. If the opImplConv method returns a
pointer to a static buffer there will not be any memory leaks, but on the other hand the two
arguments will always be the same as the buffer will be overwritten in the second call to
opImplConv. On the otherhand, if opImplConv returns a pointer to a new buffer each time, how
can the application know when this buffer can be freed?

This dilemma can perhaps be solved by allowing the application to register the charptr with an
extra flag asOBJ_NOSTORE to tell AngelScript that it must not allow the script to declare any
variables with this type. This way the application can implement a destructor for the charptr to
free the buffer when the temporary variable is no longer in use, i.e. after the function call.

Optimize LoadByteCode performance - 2015/06/18 


http://www.gamedev.net/topic/669305-very-slow-loading-of-bytecode-on-ios/

The load times for large application registered interfaces has been improved by a factor of 4 in
version 2.30.2 WIP.

Improve the logic for matching script functions in the module too, to improve load times for large
scripts too. The logic should be similar to the matching of engine functions.

Look for other things to improve. Looks like asCReader::ReadObjectTypeDeclarations might be


one of the biggest offenders at the moment.

Verify access mask while loading bytecode - 2015/06/28 


Currently the access mask is not verified while loading bytecode. If application doesn’t properly
validate the origin of the bytecode this might be abused to call functions that should otherwise
not be available.

Support registering functions from within scripts - 2015/04/05 


http://www.gamedev.net/topic/667354-register-system-function-after-build/

Functions must be prepared when retrieving the function pointer.

Use external catalogue for texts - <2014/12/31 


To better support multilanguage applications the scripting engine should support using an
external message catalogue for the compiler and runtime messages. This way the application
will be able to switch the language at runtime without having to recompile the library.

Messages that take multiple arguments, such as %d and %s should number the arguments, as
depending on the translation the argument may not appear in the same order.
The add-ons should be allowed to use the same message catalogue via public methods in the
scripting engine.

Recompile script without destroying objects - <2014/12/31 


Allow recompiling bytecode without destroying objects. In this mode, functions with the same
function signature will simply have the bytecode updated, but will otherwise remain the same.
There are obviously restrictions for this to work. Classes cannot change its properties, interfaces
cannot change its members, global variables cannot change types, etc.

Improvement for switch statement - 2012/07/19 


Switch case doesn't recognize when all cases have return statements

http://www.gamedev.net/topic/679958-angelscript-compiler-exhaustive-switch/

Returning references - 2011/04/25 


Look into improving the way returned references are treated

Allow assignment on temporary object - 2011/06/23 


Look into suggestion to allow assignment on temporary objects

Additional type flag to tell compiler to prevent storage of type - 2012/02/01 


A new flag for RegisterObjectType()

asOBJ_NOSTORE

This flag can be used with both asOBJ_REF and asOBJ_VALUE.

What it does is to tell the compiler that this type cannot be used to declare global variables or
script class members.

The application must be careful not to store the type if it receives it in a function call.
It might be possible to allow a script class to hold the object type, but then the script class must
also become NOSTORE. It must also not be allowed to inherit from non-NOSTORE classes or
interfaces if this happens.

It should still be possible to declare templates, but then the template will also become a
asOBJ_NOSTORE. The template callback should provide the modification of the template
instance flags. This will require some changes, but without it, the engine would have to assume
all templates will store the value, which may not be true.

The type can still be used to declare local variables and function parameters.
The usefulness of this is to control the lifetime of the variable. Applications often have objects
that they need full control over when and where they are created/destroyed, for example, pooled
game entity objects. There is currently no good way of allowing a script to interact with this type
of object, while preventing the script from storing the object for later use (when the object may
no longer exist).

Forum thread that gave me the idea

(priority) Add asIProperty - <2014/12/31 


This interface can represent either registered global property, script global variable, or object
member property.

The interface should have members to get type, name, namespace, declaration, offset,
accessMask, configGroup, address, etc

This will remove some members from asIScriptEngine, asIScriptModule, and asIObjectType,
e.g.:

● GetGlobalPropertyByIndex (changed to return asIProperty instead of all the parameters)


● GetGlobalVarDeclaration
● GetGlobalVar (changed to return asIProperty instead of all the parameters)
● GetAddressOfGlobalVar
● GetProperty (changed to return asIProperty instead of all the parameters)
● GetPropertyDeclaration

It might even be used to represent a local variable in functions and can be returned by
asIScriptContext for debugging

Update 2017/02/20: Perhaps this can be included for release 2.32.0.

VM should clear new allocated memory to avoid randomness - 2011/10/09 


When a new script class is allocated, it's memory should be cleared. When a new function is
entered, the stack should be cleared. This will guarantee that all executions will always be the
same even if some variable is not initialized.

AngelScript will not guarantee however that all uninitialized variables will have the value 0. For
example in a loop, variables that are not explicitly initialized will take the value of the last
iteration.
forum post

Provide parsing details to application for intellisense - 2011/02/03 


It would be interesting in adding a way for the application to tell AngelScript to parse a script
(instead of building it) and then have it return the identified functions, classes, etc.
idea on forum
Application callbacks during script parsing - 2011/01/11 
Evaluate the ​suggestion on GDNet​.

Reduce memory allocations for value types 


Value types passed by value to function - 2015/07/28 
Value types passed by value to a function are currently allocated on the heap. This often
requires temporarily allocating dynamic memory in order to store a copy of the value on the
heap.

The calling convention should be modified:

● The calling function should store a copy of the value on the stack as a local temporary
variable, and then just pass a reference to the value to the function.
● The called function will be allowed to modify the value without impacting the calling
function.
● Who should be responsible for calling the destructor on the value? The calling function
or the called function? The answer to this depends on what will be most performatic in
the native function calls.

The as_callfunc modules will have to be adjusted for this.

The exception handler must be adjusted for this.

Value types as members of script classes - 2015/07/28 


Non-POD value types as members of script classes are currently allocated on the heap. This
should be changed to be inline. The exception handler must be adjusted to be able to properly
clean up the object if an exception occurs in the constructor.

When a class holds value types the compiler should allocate a bitmask for checking if the value
type has been constructed before access, and if the type has to be destroyed upon exception.
Value types without registered destructors do not need to be checked as it can be considered to
be safe to access the uninitialized memory (even though .

Each bitmask of 8bits can represent 8 members. The compiler should allocate the bitmask
intelligently as pad-byte to properly align the other members.

Specific bytecode instructions should be used to optimize the validation. It can possibly be done
with a single instruction, perhaps even as a replacement for the current asBC_ADDSi instruction
used to offset to object pointer to the member. As currently the value types are stored on the
heap, this check ought to be faster than the current pointer dereference to get to the member.
Support return values with suspending functions - <2014/12/31 
Implement a way to suspend the script from a system function, and then return a value when
resuming the execution.

Currently it is only possible to do by implementing a proxy function, like this:

int Wait()
{
Suspend();
return GetReturnValue();
}

Ideally the application should be able to register the int Wait() function, with some special flag,
e.g. SUSPEND. The context should then provide a way to set the returned value before the
Execute() function is called again.

Provide proper memory alignment for value types - 2011/07/15 


SSE instructions that are so common in todays application require that the vector types are
aligned on 16 byte boundaries when they are loaded into the registers. If this is not the case the
application crash with an exception.

Currently AngelScript doesn't guarantee this alignment for value types. The work around is to
use scoped reference types, where the application can guarantee the alignment as the type is
allocated on the heap.

AngelScript should be able to provide this alignment. There should be a new flag
asOBJ_APP_ALIGN16 that will tell AngelScript the alignment must happen. A flag
asOBJ_APP_ALIGN8 may also be needed.

forum thread

Partial compile to bytecode for later linking - 2011/09/25 


Suggestion by orm​.
It might be interesting in having a partial compile-to-bytecode. Each script section could possibly
be built individually, and then linked together into the final module at a later time. Similar to how
C++ works.

This would require the ability to declare functions and classes in header files, so script sections
can know how to call them without actually knowing the implementation.
Append to existing modules - <2014/12/31 
Allow the compilation of new script sections to existing modules. The code should be merged
with the already built code. When the functions overlap, they should either be replaced, or an
error should be given.

I'm not quite sure how this will work, but it is something I would like to add.

New forum thread asking for something similar.

Chained executions of scripts - <2014/12/31 


It should be possible to chain executions of different functions in a context.

The way I'm thinking about implementing this is to have the context call a callback routine when
the current function exits. The callback routine can then set up the next function that should be
executed, thus allowing the context to continue without leaving the Execute function. This will
also make it safer to allow statements in the global scope, as the application would be able to
control and abort any misbehaving scripts.

Another improvement is to have allow an application called function to attach a new script
execution to the current context. This will allow the context to be suspended and resumed, as if
the current context had called the script function directly. When the secondary context is
suspended, it will also suspend the primary context, thus returning from the original Execute()
call. When the primary context is resumed, it will resume the secondary context as well.

This second improvement would be useful for 'dispatch' calls, where the original script calls
another function through an application function by giving the name of the function. It can also
be used by container classes that initialize script objects, e.g. array of elements. The secondary
context can use the chained execution functionality to initialize each element in sequence.
The debug interface must be able to see the secondary contexts so that both can be properly
inspected.

Remove import directive from the core engine - <2014/12/31 


The import directive can be implemented from the preprocessor. It can for example scan for the
following:

#import void func() from "module";

And substitute with:

funcdef void _import_func_(); _import_func_ @ func;


After the compilation is done, the builder would then scan for these function pointers and point
them to their respective functions in the other module.

Improved garbage collection - <2014/12/31 


When an object notifies the garbage collector of itself, it should be possible to tell the GC that
the object will be long lived, thus placing it in the old generation list directly.

The sequence number given to objects added to the GC can possibly be used to better
determine the age of objects so that they are moved into the old generation at a more optimal
moment.

Perhaps it may be useful to have a method for removing an object from the GC. Of course, this
must not be done for script objects, but it could be useful for application objects. To be quick the
GC would need a structure to allow lookup, e.g. a hash map.

A lot of potential garbage collected object never actually forms circular references. Ideally they
would not be placed in the garbage collector while a known owner is holding it. For example: an
object allocated on the stack wouldn't have to be placed in the garbage collector until the
variable goes out of scope, and then only if the refCount is higher than 1 when that happens.
The longer an object is kept out of the garbage collector, the less work the garbage collector will
have.

(update on 2017/12/07) If I can somehow let the object constructor/factory know if the object is
being created for a local variable on the stack, then the constructor could defer the notification
to the garbage collector to the asBC_FREE call, and the asBC_FREE call could then notify the
gc only if the refCount is higher than 1, which means no other references to the object were
taken.

Perhaps a flag in the script context can be set, which the constructor/factory can check before
calling NotifyGarbageCollectorOfNewObject (or perhaps NotifyGarbageCollectorOfNewObject
itself could check the flag).

Would this work even for members of objects?

Update 2018/01/08

The GC could hold a hash of known owners to objects. This would allow the GC to keep these
objects out of the gc routine until the owner is removed. It would also allow the script engine to
maintain these owners without requiring changes to registered objects, as the owner could be
informed after the creation of the object. The application could also be allowed to add owners to
optimize memory management. Owners should only be added when it is known a circular ref
cannot be created, e.g for stack and global variables. Member variables should only be owners
if it is known that the actual object itself has an owner.
(priority) asOBJ_GC for value types - <2014/12/31 
Must be possible to use asOBJ_GC for value types, e.g. the CScriptHandle can indirectly form
circular reference with an object.

Auto garbage collect on asBC_FREE - 2015/01/05 


In order to reduce the delay on destroying garbage the garbage collector should probably be
executed on asBC_FREE and ReleaseScriptObject instead of on AddScriptObjectToGC.

Only execute it if the object being freed has the gc behaviours, so we don't impact the execution
negatively for objects that are not even garbage collected.

Option to disable garbage collector - <2014/12/31 


Add engine property to disable garbage collector (at the risk of memory leaks).

When this is done the ​NotifyGarbageCollectorOfNewObject ​call should not do


anything.

Improved memory usage - <2014/12/31 


Right now the compiler will compile all the code in a script, whether it is used or not. It would be
great if the application could tell the compiler which would be the entry points, so that the
compiler could simply discard the rest of the stuff thus freeing up memory.

Some other stuff that isn't necessary to keep around is the enums and typedefs that won't be
used again unless other compilations are done.

Support smart pointers - 2009/07/07 


What can be done to support smart pointers?

Smart pointers is a class that holds a pointer to the real object. The class usually has the ->
operator overloaded so that accessing members of the real object works just like accessing
members through a normal pointer. The smart pointer may also take care of reference counting.
When registering the type controlled by a smart pointer it would be necessary to tell AngelScript
that it is a smart pointer. A new special behaviour is necessary to register the -> operator so that
the VM can automatically access the true object. When registering the members of the object it
would also be necessary to indicate which members are accessed through the -> operator, and
which are accessed directly.

How would it work to pass objects of this type to application functions, or return them from
application functions? Usually objects held in smart pointers, are passed as normal references
to application functions, but sometimes it really is a reference to the smart pointer itself.
It should be completely transparent to the scripts if an object is a smart pointer or not.
Custom operator tokens - <2014/12/31 
It would be interesting to allow the application to define it's own operator tokens and the class
methods that implement them. The application could then add operators for things like dot
product or cross product. It may even be possible to simplify the core library with this.

Custom literal constants - 2010/11/05 


Analyse the possibility of allowing the application to create custom literals, for example 112i for
imaginary parts. ​Suggestion by mk1x86​.

Another similar suggestion​.

Improved multithread support - 2007/06/12 


Add multithreaded support for more platforms. Add documentation for how to turn off
multithreading for performance improvements in non-multithreaded environments. We may also
be able to optimize the multithreaded code slightly by using code from LDK library, ​suggestion
by Lorien Dunn​.

Allow applications to disable global variables in scripts through an engine property. This is
useful if the application plan on having multiple threads execute scripts from the same module
simultaneously and don't want to burden the script writer with having to think about how to
control the access to the global variables to avoid memory corruption.

Multiple OS fibers - <2014/12/31 


Look into properly supporting switch of OS fibers from within script contexts. Perhaps we need
to use a fiber local storage for the stack of active contexts in order to permit this kind of
switching.
Currently if you have two contexts running in different fibers that switch between each others
from within asCScriptContext::Execute, the asGetActiveContext() function may not return the
correct context. In debug mode it may cause assert failures, as there is a check when popping
the active context to make sure it is the correct one that is popped.

A switch of fibers from within asCScriptContext::Execute may also leave loose reference on the
context stack if the application registered function that performs the switch is not properly
implemented. To guarantee no loose references, the function should be a void function that
takes no arguments. This way the script can only call it as a simple function call, rather than in a
complex expression.

Optimize bytecode for member variable access - 2016/10/28 


class TestClass {
array<int> @mArr = array<int>(2);
int func() {
mArr[0] = 0;
mArr[1] = 2;
int total = 0;
for( uint n = 0; n < 2; n++ ) {
total += mArr[n];
}
}
}

A script like this would call AddRef and Release on the member variable mArr on each access
to the index operator. This is done because the compiler currently has no way of knowing that
mArr is actually going to stay alive throughout the call to the index operator. Without the AddRef
and Release calls the array could potentially be destroyed in the middle of the call, causing a
crash on the application.

To improve performance the compiler could be changed to recognize that the same member is
accessed multiple times in the function and only calls the AddRef and Release once.

I could also add an engine property to allow the application developer to decide whether the
AddRef and Release calls aren’t necessary if he/she trusts the script writers not to write bad
scripts.

Better validation of registered functions -2007/08/07 


I would like to provide means for automatically validating the signature of the registered
functions. If AngelScript provides an interface for determining the parameter types, based on
function id, the application can use templates to automatically validate all of the parameters. It
isn't possible to automatically generate the function declaration by means of templates, e.g.
should a parameter reference be a &in, &out, or &inout? But it is possible to verify that a
AngelScript parameter reference is mapped to parameter reference in C++. Doing this
automatically, it will be easier to avoid stack corruption when AngelScript calls the C++ function.

Stack corruption happens for example when AngelScript passes a structure by value, but the
C++ function expects a reference, or if the C++ function returns a value in memory, but the
function was registered as void.

Can the calling convention be determined with means of templates? I.e. is it possible to use
templates to determine whether a function should be asCALL_CDECL or asCALL_STDCALL?
Example code from SiCrane

Registered comparison operator - <2014/12/31 


For application registered types that register the comparison operators directly the engine could
automatically construct an opCmp method so that the compiler doesn't have to bother with all
different behaviour types.
If only the equality operator is registered then only the opEqual function will be supported. To be
able to do all comparisons, one equality behaviour and one relational comparison behaviour is
needed. Example: "less than" and "equal". The function will first compare with "less than", and if
not less, it will compare with "equal".

Improving context interface for calling script functions - <2014/12/31 


I need a single function that can be used to set any argument. Something like SetArgValue(int
index, void *ptrToValue, bool takeOwnership = false).

When the argument is an object handle and takeOwnership is false, the context will
automatically increase the reference count. If takeOwnership is true, the context won't increase
the reference count, which means the application must not release it.

When the argument is an object by value, the context will automatically create a copy of the
object, unless takeOwnership is true, in which case the context will store the object pointer and
then release it upon completion.

Improved portability - <2014/12/31 

Improved support for complex types in native calling conventions 


● PPC has very complex calling conventions and although AngelScript handles most
cases well, it has problems when passing complex types around by value, either in
parameters or as return value. For example a structure with only float values should be
passed in the registers instead of in memory. Likewise, there is a vector type that has its
own registers that AngelScript doesn't even know about yet.
● In order to be able to support functions natively (the generic interface already works) that
pass these types around by value, AngelScript must know the exact layout of the
structure. A change to the way types are registered is needed to support this, and the
PPC native code must also be improved.
● A simple template helper function could be written that will allow values to be passed by
value rather than by pointer. Otherwise you won't be able to call the function with a literal
constant value.
● x64 platforms suffer from the same restrictions, as here too structures are split up by
members into different registers when the object is passed by value.

Support for float vectors in native calling conventions - 2011/05/19 


● forum thread

AngelScript calling convention - <2014/12/31 


Objects parameters
All objects should be passed by reference, as if it was a const reference. The script functions
that access object parameters for modification will copy the object first and then access the
copy instead. Application registered functions that register parameters with non-const input
reference should be wrapped automatically, by the compiler to pass a copy of the object to the
parameter.
This will allow me to remove parameter references from the script language, without losing the
performance benefits of using const &in references.

Parameters can still be declared as const, but it won't make a difference to the caller, as it will
always pass parameters expecting them not to be modified. This may affect function
overloading.
Object handles
The caller should be the owner of the object handles passed to functions. This will reduce the
number of addref/release calls made during script execution. It will also simplify the registered
application functions, as they will no longer have to release the handles received in parameters.
The script compiler will need to make sure that all object handles passed to functions are stored
in local variables (or parameters in the function). This is similar to how the compiler currently
guarantees the validity of references.

In order to avoid abrupt changes to applications I'll implement this feature as an engine
property: asEP_CALLER_OWNS_HANDLE. The value will be false by default. After a few
releases I can change the default to true. Then after even more releases, the engine property
can be removed all together.

Allow implicit conv for const &inout - 2015/09/28 


http://www.gamedev.net/topic/672029-unsafe-const-in/

Can this be allowed even for safe references? Should an engine property by used to turn on/off
this feature?

Improved object type registration - 2007/10/06 


Look into what to do with asOBJ_NOHANDLE and ALLOW_UNSAFE_REFERENCES.
Currently the engine permits the types to be passed by reference. It probably shouldn't allow
that, but is it necessary to block it?

Can we determine the asOBJ_APP flags through templates without loosing portability?

Evaluate the possibility of using dynamic calls - <2014/12/31 


It might be possible to implement something like dispatch calls in AngelScript. This is something
that would work for any object, and may make it easier to write scripts for some situations. What
the compiler would do is something like this: 1) build a list of arguments, including a reference to
the object, as well as the name of the function. 2) call a built in dispatch function. The dispatch
function would then check the object type to find the matching method and calling it. If no
matching method is found an exception is thrown. Combine this with the generic superclass
Object that all classes inherit from and you have a completely dynamic type. A special dispatch
operator would be needed so that the script writer can choose compile time or run time
resolution of the method. Possible syntax: object->function(23, 43)

This could even be used to access properties, using the property accessor style. An expression
like this: int val = object->prop; would be compiled as GetObjectProp(object, 'prop', val), where
the last parameter is an output parameter. If the property type doesn't match the output
parameter then an exception is thrown.

Investigate possibility of allowing reference cast behaviours for value types 


- <2014/12/31 
Currently it is not possible to establish class hierarchies for value types. What would the
implications of allowing this be? Is there any danger of allowing a temporary reference cast?

Allow -fstrict-aliasing - <2014/12/31 


Compiling the library on g++ based compilers with -fstrict-aliasing produces several compiler
warnings, due to the way the code does a lot of pointer tricks. If these warnings can be fixed by
changing the code, it may allow the g++ compiler to improve the performance through better
optimizations.

what is strict aliasing?

Thanks to Richard Viney that alerted me to this problem.

More engine properties - <2014/12/31 


Possible engine properties:
● asEP_MIN_STACK_SIZE to set the minimum stack size allocated upon creating a
context (might allow improving runtime performance)
● NO_64BIT_TYPES, which removes double, int64, uint64, etc.
● MAX_PORTABILITY, which removes support for native calling conventions.
● ALLOW_POINTERS, add support for pointers.
● NO_GLOBAL_STATEMENTS, which disables the use of global variables/statements in
scripts. Default: FALSE.
● NO_IMPORTS, which disables the use of bound functions in modules. Default: TRUE.
● ALLOW_BOOL_CAST, which adds implicit conversion to/from bool
● It should be possible to enable/disable warnings by type.

Improved information on null pointer exceptions - 2015/04/01 


Forum thread
Automatic translation of the string type to other C++ built-in types - 
<2014/12/31 
In C++ it is very common to use at least two different representations of character strings, e.g.
std::string and char*. I want to allow AngelScript to automatically translate the registered string
type to either of them so that the application doesn't have to use wrapper functions.

It will probably need a new behaviour on the string type, as well as a new indicator when
registering the function that needs the translation.

Suggestion by Manu Evans.

Registration of true constants - <2014/12/31 


It should be possible to register literal constants.

Support for @+& (autohandles with reference to handle) - <2014/12/31 


This requires that the script engine keeps a copy of the value before going into the function,
then upon return increases the reference on the returned handle, and then decreases the
reference on the previous handle.

Suggestion by Dentoid.

Improved memory footprint - <2014/12/31 


I've made great improvements on the memory footprint already, but at some time I will probably
go back to this problem to see if I can improve it even further.

Statement blocks can be parsed one statement at a time, which will improve memory utilization
when compiling large script functions.

Need engine properties to discard information that are not needed for runtime operation, i.e.
enum values, type defs, local variable names, line numbers, etc.

Registrable context properties - <2014/12/31 


Requires:​ Shared/non-shared global variables
A context property is a non-shared global variable registered from the application. After creating
the context, the context property must also be set, otherwise a null pointer exception will occur.
I'm not sure if this is actually useful, so this will probably not be implemented.

dynamic inclusion of script code - 2007/03/16 


It may be interesting to be able to include script codes for execution inside functions,
dynamically at run-time. The script code should be injected into the script stack so that it can
access the variables in the function, much like a run-time generated macro. ​Idea by Dave
Krusu​.
Persistent script states - 2011/05/01 
It would be great if it was possible to save/load the script state, including the context stack. This
is difficult to do, but I believe it can be done. It would require registered types to have a
serialization behaviour.

References to members of objects can probably be identified if the serializer knows the size of
objects. But if the reference is to some random location then the serializer would have no way of
knowing how to identify it.

An initial implementation can be found here: ​forum post​.

Improvements for JIT compilers - 2009/06/14 


A discussion on the subject with interesting ideas for implementation​.

Flag for trivial functions - <2014/12/31 


Add a flag that the application can set on application registered functions that do not access the
asIScriptContext for setting exceptions, or inspecting the callstack. The JIT compiler can then
avoid updating the context's member variables when calling such functions, thus improving
performance. (Suggestion by Andrew Ackermann from Blind Mind Studios)

asIScriptFunction should allow application to get function pointer - <2014/12/31 


It would be nice to allow the application to get the registered function pointer from the
asIScriptFunction interface. There may be situations, e.g. when doing JIT compilation where it
would allow for better optimizations. It would be necessary to think about how to deal with virtual
methods and multiple inheritances, as these are not just simple function pointers. (Suggestion
by TheAtom)

Less SUSPEND instructions - <2014/12/31 


REMOVE_LINE_CUES_BETWEEN_TRIVIAL_STATEMENTS, this does a slightly less radical
optimization than BUILD_WITHOUT_LINE_CUES. SUSPEND instructions for statments that
make calls to other functions or conditional branches will be kept to allow proper debugging.
This one will be important for JIT compilation as it will allow longer sequences of bytecode to be
transformed into machine code.

Constant Folding, or compile time evaluation of functions - <2014/12/31 


Jason Dorie, from Visual Concepts, gave this suggestion.

Basically, the application would indicate functions that may be evaluated at compile time, if the
arguments are all constants, e.g. sin(0.5), or similar constant expressions. The compiler would
then replace these expressions with the final result, thus avoiding the runtime call to the
function.
I'm in doubt how useful this would actually be. After all, how often are functions that can be
evaluated at compile time used in scripts? Also, it would probably only be possible to use when
the function returned a primitive type, which makes the feature even more restrictive.

Perhaps there is a way to make it work for functions that return non-primitives. If so, it could
possibly be used on the string factory which is definitely used sufficiently to make something like
this worth it.

Huge object types - <2014/12/31 


Support huge object types, i.e. RegisterObjectType with offset larger than 16bit. Will require
changes to VM, Compiler, and bytecode serialization

This need was first identified by Sam Shemitz (Violet CLM)

Allow engine to see script entities declared as shared - <2014/12/31 


Engine should be able to enumerate shared types since they are not specific to a single module
anyway, e.g. GetTypeIdByDecl, etc

Support C++11 move operators - 2011/06/11 


Investigate adding support for C++0x move constructor and operators. Suggestiong by Zoner

(priority) Methods for querying where entities have been declared - 


<2014/12/31 
Add methods for querying where entities have been declared, i.e. script section and line
(Suggestion by Allister Wilson)

Update 2017/02/20:
https://www.gamedev.net/topic/686589-debugger-determine-a-breakpoint-line-is-valid/

Optimize registering the application interface - 2014/09/12 


http://www.gamedev.net/topic/660259-loading-binding-data/

Look into what can be done to optimize the application interface to better support what is done
in above thread.

Change interface for registration - 2016/01/16 


http://www.gamedev.net/topic/674734-refactoring-suggestions/

Consider changing the methods that register properties, methods, and behaviours for objects to
take an asITypeInfo pointer instead of the name of the object. Example:

asITypeInfo *type = 0;
engine->RegisterObjectType(“object”, 0, asOBJ_REF, &type);
engine->RegisterObjectBehaviour(type, asBEHAVE_ADDREF, “void f()”, …

(priority) Optimize lookup of methods in objects - 2016/01/16 


http://www.gamedev.net/topic/674734-refactoring-suggestions/

Applications that cannot pre-cache function and method pointers that will be called, are severely
penalized when doing dynamic lookup of method pointers and functions.

The methods in the objects must be ordered alphabetically so that it is easy to do a quick lookup
by name.

The comparison of signature can perhaps be made quicker by creating a separate object to
store the signature, i.e. parameter types and return type. This way the lookup can simply
compare the pointers to check if they are identical.

It would also likely permit reducing the memory consumption.

Allocatable user data ids - <2014/12/31 


Evaluate possibility of implementing allocatable user data ids (suggestion by Brian Ellis)

Allow storing user data for all registered entities - 2015/09/04 


http://www.gamedev.net/topic/671433-documenting-registered-api/

Evaluate some way of allowing the application to store user data for all registered entities:
- global properties
- member properties

The properties would require a new interface. Though the solution should avoid adding an extra
pointer for each property declaration to avoid unnecessary memory usage for applications that
don’t use userdata. (Perhaps this is not such a big concern considering that it is only for the
declarations?)

Template functions - 2015/10/23 


The idea is to allow the application to register functions like this:

engine->RegisterGlobalFunction(“void func<T>(T &in)”, ... );

When the function is called by the script, the type of T would be passed to the application along
with the argument, so that the application can dynamically determine the type of the argument.

A compiler callback would also be needed to allow the application to evaluate if the function can
be used with the desired type or not.
The restrictions would be similar to member methods of template types.

A forum thread: ​http://www.gamedev.net/topic/672718-template-idea/

(unplanned) Constant text literals - 2015/07/29 


String literals should have their own built-in type, e.g. text. This type should be read only. It
should also not be possible to declare non-const variables of this type.

The string add-on should be implicitly constructed from the text type. The text type itself has no
operators, but a string type can be directly compared with the text type.

The text literal should be stored as a char array. The length of the array should be stored 4
bytes before the address. This way registered functions that receive a text literal can
immediately know the size without doing a strlen().

Application registered functions that can receive a normal const char* or a text type must always
use strlen() to determine the length.

If the string factory is registered then the built-in type is not used, instead the string literals will
work as they do today.

2016/11/16 - With the external string cache that I’m planning to implement, does it really make
sense to add the internal built-in type? Probably not, as the problems that I meant to solve with
this will already be solved with the external string cache.

2017/11/19 - The external string cache has now been implemented in version 2.32.0.

(unplanned) Support for UTF16 encoded scripts - <2014/12/31 


AngelScript already supports scripts encoded in UTF-8. It also supports UTF-16 encoded string
literals through the engine property asEP_STRING_ENCODING.

Adding a UTF-16 code scanner for the compiler might be interesting. This would allow
applications to avoid having to convert script code to UTF-8 before compiling it.

Update 2017/Nov/19 - The conversion from UTF16 to UTF9 should be done by the
preprocessing pass.

(unplanned) Support debug only functions - <2014/12/31 


I'd like to support registration of functions like assert() that is only used in debug mode. In
release mode the function will be removed, together with the argument expression.

Update 2017/Nov/19 - The removal of function calls and arguments should be done in a
pre-processor pass.
(unplanned) Allow script classes to inherit from application classes - 
2009/05/22 
Investigate the possiblity of allowing script classes to derive from application registered classes.
May work if the application class derives from the internal asCScriptStruct class.

Some info

Given that inheritance can be ​supported through proxy classes as described in the manual​, I’ll
probably not implement this. (2015/07/13)

(unplanned) GetErrors() method - 2012/03/26 


Provide a GetErrors() function()

forum thread

Use an engine property to determine whether system errors should be sent to the message
callback or just the geterrors function. Default to sending to message callback too.

I currently don't think this is necessary. Someone that would prefer a GetErrors like function can
easily implement it using the existing message callback. (2015/06/30)

(unplanned) Support for registration of classes with virtual base classes - 


<2014/12/31 
I'll probably never implement this support. It is highly compiler dependent and would be difficult
to support on all platforms. Besides, it is something that is very rarely used in C++ programs,
and especially games and other high performance applications, due to the extra overhead it
adds to method calls.

(unplanned) Allow registering a behaviour for the not operator - 


<2014/12/31 
Permit applications to register behaviours for the not operator. Just like it is currently done for
the negate operator.

Suggested by Gilad Novik.

Do I really want to allow this? What would it mean? AngelScript doesn't allow implicit
conversions of types to bool. Why should it allow a non boolean type to use the 'not' operator?

(unplanned) Cloning modules - <2014/12/31 


Cloning modules will create an identical copy of the first module. The result should be the same
as if a second module had been compiled with the same script.
The function ids for each module will be different, as a function id is a global id the uniquely
identifies a function in the engine. The same goes for object types. This is especially important
when the functions/classes accesses global variables in the module.

Interface ids will however remain the same for both modules.

A module can also be cloned by saving the bytecode from one module and then reloading it into
another.

(unplanned) Improve support for doublebyte encoding for scripts - 


2010/08/05 
suggestion

I believe it is better to use UTF8, which AngelScript already supports.

   
Script language 
(priority) Disable bitwise operators on non-integer types - 2017/11/02 
https://www.gamedev.net/forums/topic/693281-bitwise-operator/

It is not meant to be possible to perform bitwise operations on float and double. Currently the
compiler implicitly converts the types to integers and then do the operation. This is likely to
produce unexpected results. The compiler should instead give an error.

Possibly change the behaviour through an engine property as suggested by Jason.

Group shared entities in a block - 2017/10/31 


As suggested by Sir Ementaler
https://www.gamedev.net/forums/topic/692197-shared-by-default/

Support for ‘pure’ keyword - 2017/10/02 


Request by Patrick Jeeves:

I would like to request a pure specifier a-la GNUC--i don't know if it's in other versions--but it indicates that the
function does not access memory outside of it's own arguments or call any non-pure functions. If this is
specified for a registered function it would indicate that it may be evaluated at compile time, which is useful if
you're hashing a lot of strings, or something similar; otherwise it would indicate other optimizations to the
compiler, but to me the valuable thing is just the first part without the optimizations, because if i'm calling a pure
function from C++ then i know what mutexes i need to lock before calling it.

https://en.wikipedia.org/wiki/Pure_function

Support for ‘deprecated’ keyword - 2016/06/15 


http://www.gamedev.net/topic/679365-deprecation-warning-for-application-registered-entities/

Patrick Jeeves also extended this idea to script entities, as some of the application interface may be
implemented in the script.

It would be necessary to be able to mark any entity as deprecated, functions, global variables, types, class
members, enum values.

(priority) Self references and value types - 2017/01/31 


https://www.gamedev.net/forums/topic/685927-tepm-object-on-multiple-sub-expression/

Study how it can be allowed to implement the << operator the way it works in C++ for value
types in AngelScript.

At least with asEP_ALLOW_UNSAFE_REFERENCES turned on, the compiler should call the
<< operator on the actual object rather than making a copy first.
With asEP_ALLOW_UNSAFE_REFERENCES turned off it might be possible to support this by
having a keyword to tell the compiler that the << operator will always return a self reference.
That way the compiler can ignore the actual returned reference and instead reuse the original
reference that it knows is safe.

Thoughts:
- non-const object methods must be guaranteed to work upon the original object, not a copy of the object
- object methods that return a reference must be assumed the reference can be to itself, thus the object the
method was called upon must be kept alive until the returned reference is no longer in use. (in long chained
expressions this may mean the object must be kept alive until the very end of the statement)

- the problem with these two statements above in combination with a value type is that it is not always possible
to guarantee the life time of the original object
- if the original object is stored in a volatile location, e.g. in a dynamically allocated buffer in an array object. the
buffer can easily be freed during an expression, thus destroying the original object

To make it work without sacrificing safety, the compiler must work on a temporary copy of the object, that it can
guarantee to stay alive. At the end of the statement, the value of the temporary object must be assigned back
to the original object (if it can be guaranteed to still be alive).

To be one perfectly safe, I would have to prohibit self modifying methods on value types. All operations with
value types must be expected to create a new instance of a value. This would severely limit the use of
registered object types.

Operator -> with overload - 2017/03/13 


The script language should perhaps have support for the -> operator, and also allow it to be
overloaded.

This would be useful for container classes as it would be possible to implicitly return the
contained object to invoke a method on it, or access a property. The weakref add-on for
example could allow a syntax like this:

weakref<character> player;
player->doSomething();

With the current code it would be necessary to do write it as:

weakref<character> player;
player.get().doSomething();

It wouldn’t be so useful for generic containers like ​any ​or ​dictionary​, since the -> wouldn’t
know what type to return at compile time. For those type of containers something else is
needed, e.g. a mechanism for dynamically invoke methods.
How useful is this really? Is it truly worth it to add the -> operator just for cases like weakref?

Chained assignment with property accessors - 2017/01/18 


https://www.gamedev.net/topic/685509-property-setter-doesnt-return/

Currently it isn’t possible to chain assignments when the lvalue is a property accessor because
after evaluating the set accessor the expression becomes void.

The compiler needs to verify if there is still another use of the property and keep the value, or
perhaps evaluate the get accessor to get the updated value.

(priority) Allow declaring constructors/factories as explicit - 2017/02/08 


https://www.gamedev.net/topic/686218-explicit-constructors/

Suggested syntax:

class Foo
{
Foo() { value = 0; }

// Don’t allow implicit conversion from int to Foo


Foo(int a) ​explicit ​{ value = a; }

int value;
}

This should also work when registering asBEHAVE_FACTORY/asBEHAVE_CONSTRUCT.

Allow declaring variables in if condition - 2017/02/02 


https://www.gamedev.net/topic/686021-syntax-suggestion-for-if-statements/

Apparently C++17 has introduced the concept of declaring variables within the if-condition. The
variable is visible in both the possible outcomes, but not outside the if-statement.

Int b;
if( int a = func(); a < 0 )
b = -a;
else
b = a;

It follows the same way of thinking as that of the for-loop, which makes it consistent and more
easy to understand.
Default implementation of opEquals and opCmp - 2016/09/04 
http://www.gamedev.net/topic/681790-problem-in-arrayinterface/

As IronHawk suggests in the post, perhaps the pointer can be directly compared for
equality/relation if no opEquals or opCmp method is implemented.

Are there any possible drawbacks with this?

Multiple return values - 2016/06/02 


There are times when I feel multiple return values would be a good feature. It would also require
allowing assignment operators to work on multiple values, which in turn would need a different
way of declaring variables so multiple variables of different types can be initialized together in a
single call with multiple return values.

I can’t think of a simple syntax for this though, given that AngelScript is strongly typed.

A discussion about the subject can be found here:


http://www.gamedev.net/topic/679009-go-inspired-features-in-angelscript/

Consider isnt as an alias to !is - 2016/03/16 


if​( a ​!is​ b )

if​( a ​isnt​ b )

This suggestion was made by Kevin Hawkins by e-mail.

Though perfectly understandable I’m not a huge fan of having lots of aliases in the language.
There are already more than I would like.

Implicit type conversion on return statement - 2015/10/16 


http://www.gamedev.net/topic/672533-implicit-object-construction-in-return-statement/

class Dummy
{
Dummy(int i){};
};
Dummy testConstruct()
{
return 2; // error, requires Dummy(2)
};
Implicit type conversion for is operator - 2013/02/15 
class​ A​{}
class​ B :​ ​ A​{}

void​ startGame​(​ ​string​ ​&​param ​)


{
A ​@a​;
B ​@b​;

​if​(​ a ​is​ b ​)
​{}

​if​(​ b ​is​ a ​)​ ​// No conversion from 'A@&' to 'B@' available.


​{}
}
http://www.gamedev.net/topic/638820-convertion-problem-no-conversion-from-a-to-b-available/

Implicit conversion to &in parameters - 2011/09/05 


Implicit conversion to const references
Allow implicit conversion from type to parameter reference, if the reference is const.

Support for #line to alter line number and filename - 2013/08/29 


The compiler would need to understand this directive so that compiler errors are reported
according to the new location. Similar to the C++ #line directive.

https://gcc.gnu.org/onlinedocs/cpp/Line-Control.html

The CScriptBuilder can use this to inject code in the script section rather than include code as a
separate script section.

Reported by Amir Ramezani

Shared global variables - 2014/08/27 


To share global variables the modules must always put the shared variables in the same slots.
That way it is not necessary to implement special bytecodes to access them.

If a module doesn't declare one of the shared variables the corresponding slot can be left
empty. That way it would still be possible to dynamically include it afterwards with
CompileGlobalVar.

When a shared global var is compiled in a new module it must not use a slot that is currently
occupied in any module.
When loading bytecodes the global variable slots may need to be adjusted if the existing global
vars use different slots.

(priority) Variables declared as & - 2014/08/19 


Add support for declaring variables as &. They would work the same way as variables declared
as @, except that they cannot be reassigned to refer to a different object. The variables must
also be initialized in the declaration.

With unsafe references turned on, they would also support non-reference types and work the
same way as & in C++.

Even with unsafe references turned off, it might be possible to support references to primitive
types, as long as the compiler can guarantee that the reference will stay valid for the entire
scope. It might for example hold a reference to a member of a class, by storing a hidden handle
to the class that will guarantee that the object stays alive.

2017/12/18 - Thomas Grip brought this up today.

Object states - 2012/01/04 


forum thread

One possible solution that would allow the implementation of object states without causing
impact to all object types is to have a specific keyword for it.

class Object : states


{
state Angry
{
void DoSomething() {}
}

state Calm
{
void DoSomething() {}
}
}

Or perhaps simply the existence of a state in the class implements the state machine for the
object.

All calls to methods in states must go through the state machine lookup, transparently, even
calls made internally by the class methods. This should be similar to virtual method lookups,
except the lookup table changes for each state.
The state could be kept in the object as a pointer to the lookup table for the object methods.
When the state is changed the lookup table pointer is modified in the object.

‘export’ and ‘import’ - 2017/03/08 


The current ‘shared’ entities feature has a few flaws:

1. Any script can declare shared entities, and can provide different implementations. The
order in which the scripts are compiled would in such cases produce different results.
2. A shared entity cannot use a non-shared entity in the module in which it is implemented,
thus it is not possible to have public interface with private implementation.
3. Currently there is no such thing as a shared global variable (though it might be
implemented someday)
4. There is no way to control which scripts share which entities.
5. Hot-loading scripts after change with shared entities can be difficult, since the original
shared entity is still in memory and will not be modified.

Some of these flaws can probably be solved with a more explicit ‘export’ and ‘import’ feature.
When a script ‘export’s an entity, the compiler will give an error if another script has already
exported the same entity. When a script ‘import’s an entity, the compiler will give an error if no
other script has exported it first.

An imported entity doesn’t mean it is owned by the module that imported it, instead the module
that imported it is simply allowed to see and use it. When the module that exported the entity is
discarded the exported entity will become invisible (and freed when the last reference is
removed). This will allow the script to be hot-loaded without getting any conflict with the
originally compiled exported entity.

The exported entity can access non-exported entities in the same module it was declared in, for
example a global variable, or classes, that shouldn’t be shared with other modules.

Control over which features that can import exported entities can obey the access flags of the
modules. Unless both modules have at least one bit in common the import won’t be allowed.

The shared entities feature doesn’t have to be removed by the export and import feature, but it
may likely become obsolete and unused.

(The existing ‘import’ feature for global functions should be removed)

Anonymous enums & typed enums - 2011/12/17 


forum thread

Mix-in functions (macros) - 2010/06/26 


Forum thread
Older idea from _orm_​,

To better support mixin functions the compiler should have the concept of auto variable types.
This is a variable type that assumes the type of the assigned expression. For example:

mixin auto add(auto a, auto b) { return a + b; }

The return type would be the type of the operator + that works on the types of a and b,
depending on how the mixin is used in the code.

Should mixins allow function overloads? It would be easier if it isn't allowed.

Closure - 2011/10/10 
Forum post​. ​C++11 closures

Closures should build on the anonymous functions implemented in 2.30.2.

(update 2015/07/13) Perhaps a closure could be implemented as a delegate, where a copy of


the values that the function should be allowed to modified are stored in an object. Once the
code that created the closure exits the updated values in the object can be copied back to the
original location (even if the closure is still kept alive)

This would avoid safety issues with the closure potentially accessing values that are no longer
valid if the closure is invoked after the original scope no longer exists.

On the other hand, it will not support multithreading (or co-routines) updating the same
variables, but that would likely not be a concern anyway.

(update 2015/07/17) Another option could be that a weakref is placed on the stack at the same
scope as any variables the closure accesses. The closure can then check the weakref behind
the scenes before accessing any variables from outside the function.

Improved anonymous functions - 2018/02/17 


Forum post​ ​C++11 lambda functions​.

(update 2015/07/17) Anonymous functions are available in the current 2.30.2 WIP, with the
following syntax: (update 2018/02/17) Added support for explicitly informing parameter types to
resolve ambiguities.

funcdef int callback(int, int);


callback @f = function(a,b) {return a + b;}
Callback @g = function(int a, int b) {

In the future I may perhaps allow explicitly giving the return type too:

callback @f = function(int a, int b) return int { return a + b; }

Support for shared global variables - <2014/12/31 


Classes, interfaces, global functions, enums, and funcdefs can already be shared between
modules by declaring them as 'shared'.

This concept could be used for global variables too. A shared global variable would be shared
between all modules, and could thus be accessed by shared classes and functions too.

When global variables are reset, should the shared globals also be reset? Probably need a flag
to let the application choose.

Should probably have an engine property to disallow sharing global variables all together.

Need to provide control to define who can share what


An AI controller module should probably not share a class with the GUI module even if they
happen to declare the same class.

Sharing of global variables may provide a security risk as the application may not have full
control over who has access to what.

The sharing at this level will only be implemented once I can find a good way of providing proper
protection. I'm thinking that maybe the use of namespace will be helpful. I could provide a way
to allow or disallow sharing in specific namespaces on a module by module basis.

Namespaces are implemented in version 2.22.2.

The idea is to expand on these to let the application set access masks for specific namespaces,
and also to disallow sharing in namespaces that haven't been given an access mask. It should
of course also be possible leave sharing open for all namespaces.

A namespace with a stricter access mask may call code in a namespace with looser access
mask, but not the other way. This is to prevent that a module shares a function from a
namespace it has access to, and that function without knowledge of the module uses methods
or worse, global variables from another namespace that the module doesn't have access to.

Namespace improvements - <2014/12/31 


Add support for ​using namespace​, to include a namespace within the current one.
Namespace improvement - 2014/11/14 
Allow use of partial scope to find symbols in nested namespaces.
http://www.gamedev.net/topic/662755-fully-qualified-namespace-when-calling-base-class-imple
mentation/

Provide easy way of manually telling compiler to implement default 


constructor, copy constructor and opAssign - 2011/07/10 
Default constructor and opAssign are not implemented automatically if a non-default constructor
is provided. With the below syntax it would be possible to have them implemented without
having to write the complete implementation manually.

class Level
{
Level() default;
Level(const Level &in copy) default;
Level &opAssign(const Level &in copy) default;
}

Another suggestion for the syntax​.

Default implementation of interface methods - <2014/12/31 


When a class implements an interface but doesn't provide the implementation of one of the
interface methods the compiler could provide a default implementation. If the interface method
is returning a value the default implementation can simply use the default constructor/factory to
initialize a value and return it.

The compiler should of course warn when providing the default implementation. If the return
value cannot be created, e.g. if there is no default constructor the compiler will give an error
instead.

Suggestion by Andrew Price via e-mail.

For each loops - <2014/12/31 


How can we add for each loops to the language. It must be possible to register behaviours (or
possibly overloadable operators) to permit a for each loop to iterate on a registered container
class (e.g. the template array type).

It must be possible to have simultaneous loops on the same container, so the current loop
position must be external to the container (like a C++ std::vector iterator).
If the content of the container is modified during the execution of the loop, or the container itself
is destroyed somehow, then the application must not crash. The actual behaviour would be
undefined though, an exception may be raised, or the loop may continue as normal, perhaps
skipping some elements.

Treat all reference types by handle - <2014/12/31 


Modern languages such as D, Java, C#, and most script languages treat all reference types by
handle, i.e. all variables of these types are only handles to instances, and all functions
parameters are also by handle.

The one thing you lose with this is an explicit assignment operator for copying content as the
assignment operator will perform a handle assignment rather than copying the content of the
object. (Though it may be possible to create another operator for this.)

The advantage of implementing this would be a cleaner language syntax, in that the @ can be
completely removed, thus also simplifying the compiler.

I haven't decided whether I really want to implement this, but I don't think it would be too difficult.
If I decide to implement this, it would be for version 3.0.0 together with the change to the
parameter references.

Note, AngelScript already supports implicit handle types by turning on the engine property
asEP_ALLOW_IMPLICIT_HANDLE_TYPES.

Initialize all variables to 0 by default - 2014/04/28 


If I initialize all variables to 0 by default then I could simplify the code somewhat. There would no
longer be a need to check if a variable is used before it is initialized. It would impact run-time
performance slightly, though not always negatively since I'm already initializing object variables
to 0 via a loop. With the change the code could simply initialize the entire function block on the
stack to 0 with a much faster implementation.

It would also be easier on the script writer I believe.

If I do this, I have to remember that variables should not just be initialized to zero when entering
a new function. The variables must be initialized to zero every time a new scope is entered, e.g.
each iteration of a loop.

This might be solved by using push and pop to handle the scope. When push is used to
increase the stack space it will be incremented with zeroes.
I may be able to do this initialization only if the compiler discovers that the variable is used
without being initialized first. That would avoid unecessary bytecode being generated, and thus
not impact performance.

Another case for the need for default initialization: ​forum post

Implement try/catch statements in the scripts - <2014/12/31 


The catch statement will allow the script to recover from an exception. The type of exception
that was thrown can be accessed from the application, if it wishes to implement such a function.

It should be possible to throw uncatchable exceptions. SetException needs an optional flag for
this.

Support for typeof() and sizeof() - <2014/12/31 


I'll implement these one day. Perhaps not as built-in functions, see the proposed reflection
add-on.

Global statements - <2014/12/31 


It should be possible to write statements in the global scope. These statements will be executed
at build time. They will be executed in the order they were declared. If multiple script sections
are included, then the statements in each section will be included in the order the sections were
added.

This also means that global variables will be initialized in the order they are declared, and that a
global variable doesn't see variables declared after it.

Functions and class declarations will still be seen from above themselves. This also means that
if a function is called from the top of the file, it can access variables that haven't been fully
initialized yet (it will only see the default value). In case of accessing object variables, this will
result in a null pointer exception.

Change script language references - <2014/12/31 


Add the alternative syntax for output references: 'out type parmname'. Turn off the current script
language references via an engine property, so that they can be turned on again. Application
functions should still be registered as they currently are, with &in, &out, etc.

See also: Parameter references

Improve multi-line strings - <2014/12/31 


Question: should I have any processing to make the line breaks the same on all platforms? I.e.
should any combination of \r, \n, \r\n, \n\r be translated into a single \n character? We probably
need to make this uniform so that the resulting string will be equal on all platforms. Heredoc
strings currently doesn't translate the line breaks.

String modifiers for different encodings - 2010/05/23 


ASCII, UCS16, UTF8

String modifier to turn on/off escape sequences - <2014/12/31 


Strings prepended with a backslash should not translate escape sequences. This is perfect for
those strings where backslashes commonly appear, such as file paths and regular expressions.
Example: \"Hello\x20there" won't be translated to "Hello there".

Better to use the ​C++ syntax​: ​r"(Hello\x20there)" == "Hello\\x20there"​ (r means


'raw')

Static arrays - <2014/12/31 


Allow use of static arrays in the scripts, e.g. int ar[3]. These will be directly compatible with C++
arrays. They will not be objects, so it will not be possible to store a handle for a static array, but
they can be passed by reference to functions.

It should be possible to assign part of a bigger array to a smaller array, e.g.:

int a[10], b[3];


b = a[3..5]; // copies index 3, 4, and 5 to the array in b

Look at the D language for more ideas on arrays.

The static array types should be treated as an easy way to declare multiple variables that can
be accessed through an index.

The static array type can have a size that is defined at run time, e.g. with a parameter name. In
this case the memory for the array is allocated on the heap, plus a hidden variable that gives the
size of the array. The same thing happens if the size of the array is fixed, but too large, e.g.
larger than 100 elements.

The static array type will only be implemented when the dynamic array type has been removed
from the language.

When passing a static array by parameter, or returning it, the size of the array must be fixed.
That way it is not necessary to pass the size of the type as a separate variable.

switch statements with string constants for case labels - <2014/12/31 


It would be interesting to allow switch statements with string constants. I could make it use a
binary search scheme to optimize the call.

Allow calling constructor from within constructor - <2014/12/31 


I'd like to allow a script class constructor to call one of the other script class constructors, so that
the code can be better reused. The compiler needs to keep track of which constructors calls
which, so that endless loops won't be created.

Data structures - <2014/12/31 


The struct will come back to AngelScript. Now it will be used to allow the scripts to declare the
exact memory layout of a structure. There will be no hidden members of a struct, and the
packing can be controlled exactly. This will make the struct compatible with C++ structs, and
allow for easier data manipulation in complex memory layouts, such as data files, etc.

It will not be possible to store a handle to a struct, nor will the struct be able to inherit from
another class or struct.

I'm not so sure about the usefulness of this anymore.

Reference types must not be allowed in data structures. Handles can be safely used in the
structures though.

To guarantee safety in the scripts the implicit copy constructor of a value type must have certain
restriction. This is to guarantee that the constructor itself doesn't destroy the structure that is
being copied before it is time. Should I prevent the user from implementing a copy constructor,
or should I simply automatically generate a copy constructor that will be used for the implicit
calls?

A method implemented for a data structure must not allow returning a reference to a member as
there is no guarantee the object itself is not destroyed by the method.

In that same sense, how can I guarantee that the object isn't destroyed during the execution of
the function.

Maybe data structures will not be allowed to have any member methods at all.

Return of pointers - <2014/12/31 


Implement pointer support again. Now with full support for access, type casts, etc.

Even though pointers cannot be used in an environment where security is wanted, they are still
very useful when the scripts are written for prototyping.
Implement class methods outside the class declaration - <2014/12/31 
Yes, I intend to allow implementation of class methods outside the class, just as in C++. I just
haven't gotten around to it yet.

(priority) Improve typedef - <2014/12/31 


Allow typedef to be used with any type, not just primitives.

The asCDataType object that defines a typedef should have a subtype to the true type. All
functions that ask what kind of type the typedef is should return what the subtype returns.

http://www.gamedev.net/topic/675384-typedef-for-application-registered-types/

Variable argument count or variadics - <2014/12/31 


I want to be able to support the ... parameter declaration. I will not implement it as loosely as C
does it. Instead the function will receive the argument count, and be able to access both the
value and the type of the value. This will make the use of the ... in scripts just as safe as any
other function.

The script will have to add an extra keyword for parameters if the argument is support to be a
return value, something like: func( (out)arg );

Forum threads
http://www.gamedev.net/topic/680460-delayed-calls/​ - 2016/07/23
https://www.gamedev.net/forums/topic/692430-variadic-arguments-support/​ - 2017/10/02

Removing parameter references from script language - <2014/12/31 


I'm thinking about abolishing the use of parameter references from the AngelScript language
(unless the option to allow unsafe references is turned on). The script language will still permit
output parameters, but would probably be renamed to just out without the ampersand. The
language would also still allow passing parameters via object handles (for those types that
supports it). What would be removed is &in and &inout.

Doing this would make the language much more consistent in the way it works, thus easier to
understand for the script writers. The impact in performance and to the application developers
shouldn't be too big.

AngelScript would still permit the application to register functions that take parameters by
reference, but only were it can be translated to the permitted AngelScript syntax. A const type &
could just as well be sent by value, and a type & would be translated to either type @ or out
type.
This is obviously a bit of a step backwards, so it's not a decision to be taken lightly. If I do it, I'll
probably change the version number to 3.0.0. A replacement should also be available at the
time this is implemented, e.g. the option to turn on unsafe references, and/or allow use of
pointers.

static declarations - <2014/12/31 


I may implement support for static declarations, that is static variables, static class members,
etc.

L post fix to indicate 64bit integer constant - <2014/12/31 


By default the script compiler assumes a 32bit constant, unless the number is larger than 32bit.
In some operations it might be convenient to be able to define the constant as 64bit by
appending an L to the number. Currently the same task has to be handled by explicitly casting
to the corresponding 64bit type, i.e. int64(0) or uint64(0).

Evaluate initialization lists for classes - 2015/08/25 


class RankRoll
{
u16 lo;
u16 hi;
}

const array<RankRoll> SH0 = {


{ 1, 25 },
{ 26, 75 },
{ 76, 94 },
{ 95, 100 }
};

In theory the compiler could create a list factory for the script class automatically. But I’m not so
sure if this will cause conflicts with more complex list patterns, e.g. like those used by the
dictionary.

Idea brought up by Brian Empson (e-mail).

‘default’ keyword to tell compiler to use the default argument - 2017/03/13 


Suggestion by Nikola Stojsic.

void test(string a, string b="b", string c="c") { //do something }


test("a", default, "test"); // use the default argument for b
parameter
test(“a”, b: default); // explicitly set parameter ‘b’ to the default
argument

When a function with many arguments have default arguments and the caller just want to
change the last, it is only possible by providing all the arguments (or use the named arguments).
With a ‘default’ keyword the caller wouldn’t have to explicitly inform all the arguments, instead
just tell the compiler to use whatever was declared as a default argument.

Breaking out of multiple nested loops - 2017/03/23 


for(;;)
{
for(;;)
{
break(2); // break out of both loops at once
}
}

This is just a thought for now.

(unplanned) extern shared namespace - 2017/03/08 


external shared namespace bar;

This simply makes all shared entities in the namespace bar visible to the module.

Update 2017/03/08
The problem with this is that a namespace is not closed, and can have other entities added to it
afterwards. This could mean that if two different modules add different shared entities in the
same namespace, and a third module uses that shared namespace to get access to the shared
entities, the result will be different depending on the order of the compiliation of the modules. It
may not be such a terrible problem, but since it may be difficult for the script writer to control the
order the modules are loaded (unless the application provides this control) I’ll have to give this
some more thought before implementing it.

(unplanned) goto statement and labels - <2014/12/31 


goto statement and labels are something that would be complex to implement in AngelScript
since it is necessary to guarantee the correct scope of variables and life time of objects.

I don't feel the benefit with this feature is high enough to warrant the added complexity in the
engine.

(unplanned) properties in interfaces - <2014/12/31 


It would be possible to implement the ability to declare properties in interfaces. The class that
implements the interface would then gain these properties as ordinary members.

When the property is accessed through the interface, the VM would have to use a lookup table
to determine the exact location of the property in the object (similar to how virtual functions
work).

I don't feel the benefit with this feature is high enough to warrant the added complexity in the
engine.

(unplanned) A common super class for all script classes - 2010/10/27 


Maybe a super class for all script classes can be implemented. The super class, won't have any
properties or methods. It is only used as a common base, so that all classes can be stored in a
common way. It could also be seen as an interface that all classes implement.

Potential drawback: Application registered classes won't always be derived from the super
class, thus separating them from the script classes. ​It might be possible to allow application
registered classes to implement script interfaces through automatically generated proxy classes​.

Advantage: All script classes will have a common denominator, facilitating the storage of them.
An application registered class that derive from an AngelScript class interface, can be registered
to have this same common denominator which should make it possible to have script classes
inherit from application registered classes.

With the use of the ASHANDLE type, which work for both script classes and application types,
there is no longer any need for this.

(unplanned) Pre/Post condition contracts - <2014/12/31 


● Contracts in C++ Standard draft
● Programming by contract on WikiPedia

I don’t consider this valuable enough in a script language to add this complexity to the engine.

(unplanned) Implicitly called functions - <2014/12/31 


Description​. I don't think this would bring any advantages to AngelScript.

(unplanned) Support initialization list for members in constructors - 


<2014/12/31 
The initialization of object members in constructors can be made much more efficient if
initialization lists are supported. This will avoid first initializing the members with their default
constructors and then overwriting that with other values.
ClassTest::ClassTest() : Member1(0), Member2(3) {}

I don't think I'll implement this, since it is a rather obscure syntax, and not really necessary.
Especially after all reference types will be treated as handles.

(unplanned) Support for multiple inheritance for script classes - 


<2014/12/31 
Multiple inheritances is very complex to implement, and causes a lot of troubles that are not
worth it.

Interfaces already allow implementing multiple interfaces in a single class.

Mix-ins is planned for a future release and will provide the support for code re-use, and is much
easier to implement. Once that is implemented, there is really very little that multiple
inheritances provides as additional advantages, and is far outweighed by the extra complexity in
the library.

(unplanned) Caseless symbols in script language - 2010/02/19 


Perhaps an engine property can be created to allow compiler to do case comparison of
symbols, i.e. myClassName == MYclassNAME

The case of symbols should be stored as when first declared, but the matching can be done
using caseless comparisons.

Only the english alphabet would have to be treated.

Reported by Philip Bennefall by e-mail.

I’m not so sure about this. It would have little benefit, and would probably decrease the
performance of the compiler.

   
Add-ons 
Script array 
(unplanned) Declaring multidimensional arrays - 2010/02/07 
Allow multidimensional arrays to be given size upon initialization, e.g.

array<array<int>> arr(10,10); // creates a 10x10 array

Currently this can be done like this:

array<array<int>> arr(10, array<int>(10));

Reported by Philip Bennefall

I’m not so sure about this anymore. It makes more sense with the syntax int[][], but not so much
for array<array<int>>. Besides, the grid add-on is a better solution for 2D arrays. - 2015/07/28

(unplanned) Optimize arrays of value types - 2015/07/28 


Arrays of value types currently allocate each object on the heap. This should be changed. How
should the exception handling work if I don't treat the initialization of all elements as a single
function call?

If value types are stored inline, then a resize of the array must not use memmove and memcpy,
because the objects may potentially hold internal references to themselves. Instead the resize
will have to use a copy constructor (or move constructor in C++11) to initialize each member of
the new buffer, then destroy the members of the old buffer. (See:
http://www.gamedev.net/topic/646508-weird-string-crash/​)

I’m not sure this optimization is actually for the better. In some cases storing the objects inline
will give a better performance, but in other cases it will give a worse performance. For example,
a resize or sort will perform much better the way the implementation is as it will not be
necessary to copy the actual objects with the change in the buffer. - 2016/03/28

(unplanned) Add + and += operator to array - 2016/03/18 


Suggestion by Nikola Stojsic (NS studios).

array<int> arr1 = {1,2,3}, arr2 = {4,5,6};


arr1 += arr2; // arr1 is now {1,2,3,4,5,6}
arr1 += 7; // arr1 is now {1,2,3,4,5,6,7}

The behaviour is similar to how strings work.


Arrays are not strings, and the concatenation for string is done much more for the convenience
of type conversion than for concatenating multiple strings by itself. For arrays there will instead
be specific methods for concatenating arrays. - 2016/04/05

Array foreach method - 2015/07/28 


Engine enhancement: It must be possible to register a child funcdef for the template, so that it is
possible to register methods that take or return arguments of that type. For example:

engine->RegisterFuncdef("void array::callback(const T &in)");


engine->RegisterObjectMethod("array", "void foreach(callback@)",
...);

The foreach method should take a function pointer that takes a reference to the element, and a
handle to a generic type. The scripts will then be able to implement custom logic to do for each
of the entries, and have a way to return that to the called through the generic handle.

The array needs to implement a lock mechanism to prevent crashes in case the script callback
attempts to resize the array, which would invalidate the reference to the element. If this is done
the resize will fail with a script exception.

Another example would be to have a custom compare callback routine for sorting the elements
in the array.

findLast and findLastByRef - 2016/02/02 


Need to have the reverse find methods too for performance.

findByRef for array<ref@> and array<weakref@> - 2016/02/02 


If the array is of asOBJ_ASHANDLE types, the findByRef should check the handle contained in
the ref or weakref type by using the opCast method and then compare the address on the
returned address.

(priority) Custom find - 2015/10/16 


Now that member funcdefs is working, the array template should have find methods that take a
callback to perform custom operations.

find and findByRef should return unsigned int - 2015/12/07 


http://www.gamedev.net/topic/673707-array-doesnt-properly-document-find-and-findbyref/

Though the arguments are correct, I’ll probably keep the code as it is, i.e. returning a signed -1
when not finding the value. I don’t really think that any array in a script will have more than
2^31-1 elements anyway.
If I do change this, remember to do the same for the string type, which also returns -1 when not
finding a value.

String add-on 
Add methods for working with Unicode - 2015/06/18 
The strings are already stored as UTF8 by default (can be modified by engine property to store
as ANSI or UTF16). The string add-on needs to have methods for manipulating the encoded
characters in the string. For example:
● countChars() would traverse the string and count all the characters
● getCharAt(uint) would return the unicode character. The index would be the byte
position, and the code would find the start of the encoded character based on that
position.
● setCharAt(uint, uint) would replace the unicode character. As different characters can
occupy different amount of bytes this function may need to reallocate the string.
● nextChar(uint)/prevChar(uint) would be methods to find the byte position of the next/prev
character in the buffer.

Functions for doing regex operations - 2015/06/18 


The strings class should support regex operations. C++11 have added support for regex
operations in the STL library. This should be used to implement this support.

Script builder 
#inject directive in CScriptBuilder - 2015/04/25 
This directive works similarly to #include, except that the directive will not add an extra script
section, instead it will inject the included code in the current script section. #inject can also be
done multiple times in the same script section.

When the CScriptBuilder pre-processes a script file and encounters the #inject directive it will
continue to pre-process inside the injected file just as if it had been part of the original file in the
first place.

Care must be taken to avoid infinite recursive #injects. The builder must be able to detect this,
perhaps by having a limit on the number of nested injects.

This feature also depends on the script compiler understanding the ​#line directive​, so the
compiler can continue to report the error messages correctly even though the script section is
composed of multiple files.

Script builder improvements - 2012/05/17 


When no name is given for a script section the builder should build one from a sequence
number to avoid sections being improperly ignored.
Improved pre-processing in CScriptBuilder​.

The #include directive must be processed inline, so that #defines in an included file only affect
the rest of the script after the include directive

The script builder should allow obfuscation through a callback.

● Should be done by a helper function that takes a string and returns the obfuscated
string.
● The helper function should take the obfuscator function as
● Obfuscation should only be done once it is known the original script compiles correctly
● Application registered functions and types must also be registered with their obfuscated
names
● Need to be able to run the string used for registration through the obfuscation to make it
easy to register

Add support for pre-compiler directives #error and #warning (suggestion by Amir Ramezani)

Pragma callback in CScriptBuilder


Store metadata as user data in script entities

Translate message column number to visual column - 2016/05/26 


http://www.gamedev.net/topic/678663-the-compiler-crashes/

Tabs are normally translated to 2, 4, 8 space characters when viewing the code in an editor.
Perhaps the builder should understand this and translate the column number to the appropriate
column using the same logic.

The application would have to inform the tab size used though.

Make the file loading a virtual method - 2016/01/22 


http://www.gamedev.net/topic/674918-request-for-script-builder-add-on/

This would make it easier for an application to implement it’s own routine for loading files. For
example to allow multiple search paths when including a script file, as mentioned by Solokiller in
the thread above.

Debugger 
Allow debugger to call opIndex - 2015/06/18 
If the object type support opIndex the debugger should be allowed to call it for inspecting
elements. The debugger should only call the const variant though so as not to modify the object.
It should be possible to call with both int arg (array) and string arg (dictionary), maybe even
multiple args separated by , (grid)

(priority) Allow user to set how members are expanded when printing the values - 
2015/06/18 
The debugger should have two commands that allow user to set how many elements should be
expanded, and how many recursive levels should be expanded.

2018/02/14 - A single command is enough:

e <expand elements>, <number of recursive levels>

When typed without argument the command should list the current settings and print the help
message.

Prepare for remote debugging - 2015/06/18 


Write article and perhaps a sample application that supports remote debugging via socket.

It needs to show how to set up a listener socket in the application that the remote debugger can
connect to, and then how the application can be paused for debugging as the remote debugger
connects.

Create a separate library for add-ons - 2011/02/16 


The add-ons should be compiled into a separate library, with their own header file.

The library may for example be called, libangelscriptx.a, or libasextra.a. Like the main library it
should have variants for debug and 64bit.

Reported by Aleksey Fakeyev by e-mail

Aleksey also provided a gnuc makefile (see e-mail)

Standardize the add-on interfaces - <2014/12/31 


Should the method names for array and dictionary be standardized? E.g. empty() instead of
isEmpty. size() instead of length. clear() instead of deleteAll()?

Templated type-of object - 2012/08/08 


Forum thread

type<int> typeOfInt;
type<Object> typeOfObject;
if( typeOfInt == typeOfObject )
{
... blah
}

It would also need a form of getting the type of an expression, or variable. Possibly with the use
of the variable argument. And of course there need to be a common base class for all of these.

http://www.gamedev.net/topic/662663-templated-type-of-object-add-on/

A built-in typeof function is not necessary, since the expression should be evaluated anyway,
especially for ​polymorphic objects that needs to be evaluated at runtime to get the true type​.

Enumerating script entities - 2010/08/04 


Inheritance maps​ can be implemented as a helper function in the add-on.

function for finding all references to a pointer - <2014/12/31 


The function should enumerate everything that can be seen by the engine (including objects in
the garbage collector) in order to look for references to a specific pointer. It will obviously not be
a quick call, but can help in debugging applications, and may eventually also be used to force
free a pointer that needs to be destroyed immediately.

Variant type + Improved any type - 2011/09/30 


The 'any' type will not be substituted for the 'var' type. The 'any' type is a generic container,
whereas the 'var' type is a generic primitive capable of storing and working with any primitive
type.

The 'var' type should have all the mathematical operators with overloads for all primitive types (+
the string type). It should also have methods like asString, asInt, asDouble to convert the variant
to a primitive.

The 'any' type could perhaps be improved to allow storing index values by implementing the
index operator.

Study _orm_'s variant type

aswrappedcall.h and functions with generic calling conv - 2015/07/20 


void func(asIScriptGeneric *gen);
engine->RegisterGlobalFunction(“void func()”, WRAP_FN(func),
asCALL_GENERIC);

This function is already implemented to use the generic calling convention and doesn’t need to
be wrapped. The WRAP_FN should throw an error in this case to avoid runtime errors.
Problem identified in e-mail conversation with burtlong.

Auto wrapper for calling script functions - <2014/12/31 


Now that we have automatic wrappers for the generic calling convention, it ought to be possible
to write automatic wrappers for calling script functions too.

Of course, since most applications have their own way of creating the contexts, and scheduling
the executions. Perhaps it's better to just have automatic pushing of arguments on the context
stack.

asDECLARE_ARG_PUSHER2(arg_pusher, float, string);

// Generates
void arg_pusher(asIScriptContext *ctx, float a1, string a2)
{
new(ctx->GetAddressOfArgLocation(0)) float(a1);
new(ctx->GetAddressOfArgLocation(1)) string(a2);
}

Improved ContextMgr - <2014/12/31 


The context manager should handle pooling of script contexts. It should also provide
functionality for allowing one script to wait for another, etc.

The context manager should also implement intelligent calls to the garbage collector.

The context manager should also permit debugging, by setting breakpoints and step-by-step
execution.

weakref improvements - 2013/10/10 


Improve the weakref so it is easier to instanciate it from the application​.

It should be possible to create the weakref by passing it the objecttype of the subtype, and not
the template type itself. The weakref constructor can do the tedious work to figure out the
correct template type.

Script reflection add-on - <2014/12/31 


This add-on will register an singleton object that can be used to inspect the script during
execution.

Implement a script add-on that provides reflection to the scripts.


It could for example allow scripts to write code like this:

int global = 0;
void func()
{
script.SetGlobalVar('global', 42);
}

It could even allow the script to inspect local variable on the callstack.

Perhaps this same add-on could be combined with the context manager add-on to create and
manage co-routines and threads and helper add-on to provide ability to evaluate strings.

This add-on could also allow executing strings, i.e. ExecuteString, and compile new functions,
etc.

(priority) asrun sample with plug-ins - 2018/01/20 


Implement support for plug-ins with the asrun sample.

The plug-in should be loaded ‘on demand’ with a pre-processor command, e.g. #plugin math (or
#pragma plugin math).

The plug-in dynamic library will need two functions, one to check for which angelscript version it
was prepared for, and another to register the plug-in with the script engine.

asbuild sample doesn’t support template callback - 2011/02/15 


The asbuild sample doesn't work for template types due to the
asBEHAVE_TEMPLATE_CALLBACK being accessed during compilation.

I need to think about how this can best be solved. Right now the
asBEHAVE_TEMPLATE_CALLBACK has to be implemented by the offline compiler, thus
making it difficult to prepare a generic compiler that fits all.

Unify the ‘any’ and ‘dictionaryValue’ types - 2017/11/19 


Should have a single add-on type for holding variable types. The dictionary should use this type,
rather than having it’s own private type.

The ‘any’ type should no longer be a reference type.

The ‘dictionaryValue’ needs to hold a reference to the engine by itself so that it can release its
content upon exit. To avoid extra pointer in the type, this could be a union with the object
pointer, so that the extra engine pointer is only stored when actually needed.
Socket add-on - 2017/11/19 
Implement a simple socket add-on. Only client socket is needed to begin with. It should have
the ability to look-up hostnames, so the script is not required to use ip addresses.

Only synchronous communication to begin with.

Later on asynchronous communication can be supported with buffering, and wait signals for
co-routines/threads.

(unplanned) Standard add-on support for wstring - <2014/12/31 


Although I've received contributions that add implement registration of wstring I do not plan on
adding this as a standard add-on. The reason is that wstring is not a highly portable type. For
example: wchar_t on Windows is 16bit, but on Linux it is 32bit.

(unplanned) Bit packer - <2014/12/31 


A bit packer object would be used to extract binary data from a string buffer. It will have
methods for unpacking all primitive types, and also arrays of these types. It can also have a
method for unpacking generic types, where the method takes a reference to a variable type (?),
then determines the properties of this type and unpacks each of them. If the variable type
cannot be unpacked (then an exception will be thrown).

   
AngelScript site 
Add links to wiki - 2012/12/28 
● 3
● 4
● 5
● http://blog.imgtec.com/powervr-developers/angelscript-2-30-1-is-out-adds-support-for-mi
ps-cpus-on-linux-and-android
● https://upvoid.com/devblog/2013/02/choosing-a-scripting-language/

Integrate Google Docs as To-Do - 2015/04/29 


It appears to be possible to read google docs from php. Perhaps I can use this to show the
angelscript to-do on the site but still have the convenience of editing it from google docs.

Add page for interesting links - 2015/08/29 


● Venumspyder youtube dev video
● Wolfire's blog post on why they chose angelscript

Set up an official GitHub mirror of the SVN repository - 2018/01/15 


https://www.gamedev.net/forums/topic/694498-git-mirror-for-angelscript-svn-repository-cmake-s
upport/
https://gist.githubusercontent.com/ticean/1556967/raw/f075637ea8c15c8861986f52b8720ef2cc
9d78ce/SVN_Git_Mirror.md

Provide compiled asrun sample for download - 2018/01/21 


I should provide a download page with the asrun sample pre-compiled in popular formats
(starting with Win 64bit). This will serve as a way for people to easily try out the script language,
and possibly also to promote angelscript as a useful batch script language.

Vous aimerez peut-être aussi