langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1 @@
SomeClass.staticMethod()

View file

@ -0,0 +1,4 @@
objectInstance = SomeClass() -- create a new instance of the class
objectInstance.instanceMethod() -- call the instance method
SomeClass().instanceMethod() -- same as above; create a new instance of the class and call the instance method immediately

View file

@ -0,0 +1 @@
my_obj#my_meth params

View file

@ -0,0 +1,2 @@
ClassName->some_function(); # call class function
instance->some_method(); # call instance method

View file

@ -0,0 +1,14 @@
// Class
[MyClass method:someParameter];
// or equivalently:
id foo = [MyClass class];
[foo method:someParameter];
// Instance
[myInstance method:someParameter];
// Method with multiple arguments
[myInstance methodWithRed:arg1 green:arg2 blue:arg3];
// Method with no arguments
[myInstance method];

View file

@ -0,0 +1,28 @@
create or replace TYPE myClass AS OBJECT (
-- A class needs at least one member even though we don't use it
dummy NUMBER,
STATIC FUNCTION static_method RETURN VARCHAR2,
MEMBER FUNCTION instance_method RETURN VARCHAR2
);
/
CREATE OR REPLACE TYPE BODY myClass AS
STATIC FUNCTION static_method RETURN VARCHAR2 IS
BEGIN
RETURN 'Called myClass.static_method';
END static_method;
MEMBER FUNCTION instance_method RETURN VARCHAR2 IS
BEGIN
RETURN 'Called myClass.instance_method';
END instance_method;
END;
/
DECLARE
myInstance myClass;
BEGIN
myInstance := myClass(null);
DBMS_OUTPUT.put_line( myClass.static_method() );
DBMS_OUTPUT.put_line( myInstance.instance_method() );
END;
/

View file

@ -0,0 +1,2 @@
ClassName.methodname(); # call class method
$instance.methodname(); # call instance method

View file

@ -0,0 +1,4 @@
obj->method();
obj["method"]();
call_function(obj->method);
call_function(obj["method"]);

View file

@ -0,0 +1,2 @@
function func = obj->method;
func();

View file

@ -0,0 +1,2 @@
module.func();
module["func"]();