#header-inner {background-position: right !important; width: 100% !important;}


Selector Methods & Dynamically Created Methods in 'Ola AH' Programming Language.


In 'Ola AH' Programming Language - methods - will be properly typed objects that can be 'passed around', most probably with a proper syntax support.

Method objects can be statically or dynamically constructed as well, with an elegant syntax support.

Any of the instructions can be dynamically created as well, will be properly typed objects that can be 'passed around' - even 'asm' instruction, after that functionality is added to interpreter or compiler, respectively. With 'Ola AH', every high-level instruction or standard library method, will be modelled & documented properly.

Selector Methods.

Selector methods are methods that return a value of the method type, and are given in their arguments list a method collection, as well as other 'arguments list'.

Selector methods will use existing method syntax, with no extra syntactic support - however when a method fulfills the requirements of selector method, we can talk about it as of 'selector method', for easier communication.


One of most basic use cases for a selector method is to select a method from 'method space' depending on other argument(s), then to return it.

An Example.

void m1(char c1) { ... };
char m2(char c2, char c3) { ... };
char m3(string s1, int64 i1) { ... };

method m4 := new method();
m4.setReturnType((char, string, int64)); // replacing a string return type with a tuple. m4.addArgument(int64, "i1");
m4.addArgument(char, "c1");
m4.insertArgument(int32, 0, "i1");
m4.addInstruction( ... );
m4.addInstruction( ... );
m4.addInstruction( ... );
m4.insertInstruction(0, ... );

method alist mal := #{ m1, m2, m3, m4 };

method mySelectorMethod(method alist mal, int8 i) {

  assert i >= 0;
  assert i <= 3;

  return mal.get(i);


method m := mySelectorMethod(mal, 1);
char c := m.execute('a', 'b');

See also, if You wish or need, ... : 'Ola AH' Programming Language Syntax.

No comments:

Post a Comment