|
Which Types should be automatically converted:
|
Class A { /* ... */ } A a = [OnStack] new A(); // or A a = new [OnStack] A(); |
namespace unit { // all declaration in this block are part of unit } |
package unit; // all further declaration are part of unit |
namespace unit { import anotherunit; } |
int myGlobalInt = 42; any myGlobalAny = initFunc(); |
int foo(int i, String s) { } |
interface IFace { public int foo(int i, String s); } int foo(int i, String s) implements IFace; int foo(int i, String s) implements IFace.foo; |
int foo(int i, String s); //is mapped to class foo { public static int operator()(int i, String s); /* alt public static int __call_static(int i , String s); public int __call_dynamic(int i , String s); */ } |
class AClass extends AnotherClass implements AInterface { int _myVar; AClass(int ival) : _myVar(ival) { _myVar = ival; this._myVar = ival; } } |
class AClass { public int foo(int i) { return i; } } AClass a = new AClass(); // extend the class with bar extend int AClass.bar(int i) { return i; } // extend instance with method extend int a.bar(int i) { return i; } // overwrite instance method overwrite int a.foo(int i) { return i + 1; } // overwrite class method overwrite int AClass.foo(int i) { return i + 1; } // failure, because incompatible signature overwrite int AClass.foo(long i) { return i + 1; |
[ // these will be evaluated while compile time use AcdkLib("acdk/net"); use AcdkClass("acdk/net/SocketServer"); use JavaClass("java/util/HashMap"); use ComClass("Ms.Word"); } |
void foo(in int ival, out int oval); |
foo(str := "asdf", ival := 42); |
void foo(int ival = 42); |
void foo(int ival, rest ObjectArray args); |
void foo(int ival, rest Params args); |
// ACDK typedef ScriptVarArray RestArgs; typedef core_vector<NamedArg> NamedRestArgs; class AClass { void foo(int i, IN(acdk::lang::dmi::RDmiObjectArray) rest); void bar(int i, IN(acdk::lang::dmi::RDNamedArgArray) rest); }; AClass::standardDispatch( const char* classname, const char* fname , ScriptVar& ret , ScriptVarArray& args , DmiClient& dc , IN(::acdk::lang::RStringArray) namedArgs , int flags , const ClazzInfo* clazzinfo , const ClazzMethodInfo* methinf/* = 0*/) { // incase of foo foo(args[0].getIntVar(), getRest(1, args, namedArgs)); // in case of bar foo(args[0].getIntVar(), getNamedRest(1, args, namedArgs)); }; ClazzMethodInfo* findFunction(...) { if (arg->isRest()) return meth; if (args->isNamedRest()) checkEnoughNamedParameter() } |
// aal class AClass { void foo(int i, DmiObject[] rest); void foo(int i, DmiNamedArgs rest); } |
class A { A(String str); String toString(); A operator+(A a) { return new A(toString() + a.toString()); } // internal name of this operator: 'operator_plus' void operator()(int i); // internal name of this operator: 'operator_call' } |
class A { // not very reasonable operator '(/^$\|@#%.,?' operator (/^$\|@#%.,?(int a); } |
class AClass { // left hand operator AClass operator+(AClass cls); // aclass1 + aclass2 -> aclass1.operator+(aclass2) AClass operator++(); // aclass1++ aclass2 -> aclass1.operator++() // implicit right hand operator in C++ AClass operator++(int); // C++ // aclass1++ aclass2 -> aclass2.operator++() // C++ only // right hand operator AClass rhoperator+(); // ++aclass1-> aclass1.operator++() // C++ only } |
obj.member+a; // obj.operator.(member).operator+(a) a+obj.member; // a.operator+(obj).operator.(member) // not the right way |
(...) [...] . ++ -- * / + - |
operator >=(...); // is operator_gt_eq(...); |
dt . dot eq = equal lt < lessthen gt > greaterthen nt ! not cm , comma pl + plus hs # hash ps % per[s]cent as * asterix mi - minus sl / slash bo [ bracketopen bc ] bracketclose dp : double point bs \ backslash vb | verticalbar rf ^ roof qs ? question la & logical and po ( parantesisopen pc ) parantesisclose tl ~ tilde at @ at pg § paragraph dl $ dollar co { closure open cc } closure close |
class AClass { public int operator()(String s, int i) { ... } public static int operator()(String s, int i) { ... } public int doSomeThing(String s, int i) { ... } public static int staticMethod(int i) { ... } } defun AnCall int (String s, int i); // or alias defun AnCall int operator()(String s, int i); defun AnPlusCall int operator+(String s, int i); defun AnStaticCall static int (int i); void foo(AnCall callable) { callable("asdf", 42); } void bar(AnStaticCall callable) { callable(42); } AnCall callable = new AClass(); // using operator()(String s, int i) AnCall callable = new AClass().doSomeThing; // use doSomeThing(String s, int i) AnCall callable = new () { int operator()(String s, int i) { ... } }; AnCall callable = AClass; // using static int AClass.operator()(String s, int i); foo(callable); AnStaticCall staticcall = AClass.staticMethod; bar(staticcall); |
ACDK_DECL_FUNC(StringAdder); class StringAdder { ACDK_WITH_FUNC_METAINFO public: RString operator+(IN(RString) s); }; |
// has to push outOf the variable of // foo.bar foo.bar = x; // or more complex (x, b) = x; |