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,40 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Dynamic is
package Abstract_Class is
type Class is limited interface;
function Boo (X : Class) return String is abstract;
end Abstract_Class;
use Abstract_Class;
package Base_Class is
type Base is new Class with null record;
overriding function Boo (X : Base) return String;
end Base_Class;
package body Base_Class is
function Boo (X : Base) return String is
begin
return "I am Class";
end Boo;
end Base_Class;
use Base_Class;
E : aliased Base; -- An instance of Base
begin
-- Gone run-time
declare
type Monkey_Patch (Root : access Base) is new Class with record
Foo : Integer := 1;
end record;
overriding function Boo (X : Monkey_Patch) return String;
function Boo (X : Monkey_Patch) return String is
begin -- Delegation to the base
return X.Root.Boo;
end Boo;
EE : Monkey_Patch (E'Access); -- Extend E
begin
Put_Line (EE.Boo & " with" & Integer'Image (EE.Foo));
end;
end Dynamic;

View file

@ -1,4 +1,4 @@
define :myClass [name,surname][]
define :myClass [name, surname]
myInstance: to :myClass ["John" "Doe"]
print myInstance

View file

@ -10,7 +10,7 @@ class Extender : BaseExtender
}
}
public program()
public Program()
{
var object := 234;

View file

@ -1,10 +1,9 @@
-->
<span style="color: #008080;">class</span> <span style="color: #000000;">wobbly</span> <span style="color: #000000;">dynamic</span>
<span style="color: #000080;font-style:italic;">-- (pre-define a few fields/methods if you like)</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">class</span>
<span style="color: #000000;">wobbly</span> <span style="color: #000000;">wobble</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">new<span style="color: #0000FF;">(<span style="color: #0000FF;">)</span>
<span style="color: #0000FF;">?<span style="color: #000000;">wobble<span style="color: #0000FF;">.<span style="color: #000000;">jelly</span> <span style="color: #000080;font-style:italic;">-- 0
--?wobble["jelly"] -- for dynamic names use []</span>
<span style="color: #000000;">wobble<span style="color: #0000FF;">.<span style="color: #000000;">jelly</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"green"</span>
<span style="color: #0000FF;">?<span style="color: #000000;">wobble<span style="color: #0000FF;">.<span style="color: #000000;">jelly</span> <span style="color: #000080;font-style:italic;">-- "green"
<!--
without javascript_semantics -- no class
class wobbly dynamic
-- (pre-define a few fields/methods if you like)
end class
wobbly wobble = new()
?wobble.jelly -- 0
--?wobble["jelly"] -- for dynamic names use []
wobble.jelly = "green"
?wobble.jelly -- "green"

View file

@ -1,5 +0,0 @@
$x = 42 `
| Add-Member -PassThru `
NoteProperty `
Title `
"The answer to the question about life, the universe and everything"

View file

@ -1,48 +0,0 @@
REBOL [
Title: "Add Variables to Class at Runtime"
URL: http://rosettacode.org/wiki/Adding_variables_to_a_class_instance_at_runtime
]
; As I understand it, a REBOL object can only ever have whatever
; properties it was born with. However, this is somewhat offset by the
; fact that every instance can serve as a prototype for a new object
; that also has the new parameter you want to add.
; Here I create an empty instance of the base object (x), then add the
; new instance variable while creating a new object prototyped from
; x. I assign the new object to x, et voila', a dynamically added
; variable.
x: make object! [] ; Empty object.
x: make x [
newvar: "forty-two" ; New property.
]
print "Empty object modifed with 'newvar' property:"
probe x
; A slightly more interesting example:
starfighter: make object! [
model: "unknown"
pilot: none
]
x-wing: make starfighter [
model: "Incom T-65 X-wing"
]
squadron: reduce [
make x-wing [pilot: "Luke Skywalker"]
make x-wing [pilot: "Wedge Antilles"]
make starfighter [
model: "Slayn & Korpil B-wing"
pilot: "General Salm"
]
]
; Adding new property here.
squadron/1: make squadron/1 [deathstar-removal-expert: yes]
print [crlf "Fighter squadron:"]
foreach pilot squadron [probe pilot]