Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,8 +0,0 @@
package My_Class is
type Object is tagged private;
procedure Primitive(Self: Object); -- primitive subprogram
procedure Dynamic(Self: Object'Class);
procedure Static;
private
type Object is tagged null record;
end My_Class;

View file

@ -1,18 +0,0 @@
package body My_Class is
procedure Primitive(Self: Object) is
begin
Put_Line("Hello World!");
end Primitive;
procedure Dynamic(Self: Object'Class) is
begin
Put("Hi there! ... ");
Self.Primitive; -- dispatching call: calls different subprograms,
-- depending on the type of Self
end Dynamic;
procedure Static is
begin
Put_Line("Greetings");
end Static;
end My_Class;

View file

@ -1,11 +0,0 @@
package Other_Class is
type Object is new My_Class.Object with null record;
overriding procedure Primitive(Self: Object);
end Other_Class;
package body Other_Class is
procedure Primitive(Self: Object) is
begin
Put_Line("Hello Universe!");
end Primitive;
end Other_Class;

View file

@ -1,20 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Call_Method is
package My_Class is ... -- see above
package body My_Class is ... -- see above
package Other_Class is ... -- see above
package body Other_Class is ... -- see above
Ob1: My_Class.Object; -- our "root" type
Ob2: Other_Class.Object; -- a type derived from the "root" type
begin
My_Class.Static;
Ob1.Primitive;
Ob2.Primitive;
Ob1.Dynamic;
Ob2.Dynamic;
end Call_Method;

View file

@ -1,11 +0,0 @@
*> INVOKE statements.
INVOKE my-class "some-method" *> Factory object
USING BY REFERENCE some-parameter
RETURNING foo
INVOKE my-instance "another-method" *> Instance object
USING BY REFERENCE some-parameter
RETURNING foo
*> Inline method invocation.
MOVE my-class::"some-method"(some-parameter) TO foo *> Factory object
MOVE my-instance::"another-method"(some-parameter) TO foo *> Instance object

View file

@ -1,3 +0,0 @@
INVOKE some-instance "FactoryObject" RETURNING foo-factory
*> foo-factory can be treated like a normal object reference.
INVOKE foo-factory "someMethod"

View file

@ -1,13 +0,0 @@
class ExampleClass {
public function exampleMethod() {
return "This is a method!";
}
public function new() {}
}
class Main {
static public function main():Void {
var exampleObject = new ExampleClass();
trace(exampleObject.exampleMethod());
}
}

View file

@ -1,13 +1,11 @@
(notonline)-->
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (no class in p2js)</span>
<span style="color: #008080;">class</span> <span style="color: #000000;">test</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">msg</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"this is a test"</span>
<span style="color: #008080;">procedure</span> <span style="color: #000000;">show</span><span style="color: #0000FF;">()</span> <span style="color: #0000FF;">?</span><span style="color: #7060A8;">this</span><span style="color: #0000FF;">.</span><span style="color: #000000;">msg</span> <span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
<span style="color: #008080;">procedure</span> <span style="color: #000000;">inst</span><span style="color: #0000FF;">()</span> <span style="color: #0000FF;">?</span><span style="color: #008000;">"this is dynamic"</span> <span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">class</span>
<span style="color: #000000;">test</span> <span style="color: #000000;">t</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">new</span><span style="color: #0000FF;">()</span>
<span style="color: #000000;">t</span><span style="color: #0000FF;">.</span><span style="color: #000000;">show</span><span style="color: #0000FF;">()</span> <span style="color: #000080;font-style:italic;">-- prints "this is a test"</span>
<span style="color: #000000;">t</span><span style="color: #0000FF;">.</span><span style="color: #000000;">inst</span><span style="color: #0000FF;">()</span> <span style="color: #000080;font-style:italic;">-- prints "this is dynamic"</span>
<span style="color: #000000;">t</span><span style="color: #0000FF;">.</span><span style="color: #000000;">inst</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">t</span><span style="color: #0000FF;">.</span><span style="color: #000000;">show</span>
<span style="color: #000000;">t</span><span style="color: #0000FF;">.</span><span style="color: #000000;">inst</span><span style="color: #0000FF;">()</span> <span style="color: #000080;font-style:italic;">-- prints "this is a test"</span>
<!--
without js -- (no class in p2js)
class test
string msg = "this is a test"
procedure show() ?this.msg end procedure
procedure inst() ?"this is dynamic" end procedure
end class
test t = new()
t.show() -- prints "this is a test"
t.inst() -- prints "this is dynamic"
t.inst = t.show
t.inst() -- prints "this is a test"

View file

@ -1,3 +0,0 @@
$Date = Get-Date
$Date.AddDays( 1 )
[System.Math]::Sqrt( 2 )