March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -1,6 +1,9 @@
# a user defined object #
MODE OBJECTFOO = STRUCT ( PROC (REF OBJECTFOO)BOOL foo event mended, ... );
MODE FOO = STRUCT ( ... )
FOOOBJECTNEW = STRUCT (FOOMEND foo exception x mended, FOO instance),
FOOOBJECT = REF FOOOBJECTNEW,
FOOMEND = PROC (FOOOBJECT)BOOL;
PROC on foo event = (REF OBJECTFOO foo, PROC (REF OBJECTFOO)BOOL foo event)VOID: (
foo event mended OF foo := foo event
PROC on foo exception x = (FOOOBJECT foo, PROC (FOOOBJECT)BOOL foo exception x mend)VOID: (
foo exception x mended OF foo := foo exception x mend
);

View file

@ -1,8 +1,4 @@
OBJECTFOO foo proxy := foo base; # event routines are specific to an foo #
on foo event(foo proxy, raise foo event);
WHILE TRUE DO
# now raise example foo event #
IF NOT (foo event mended OF foo proxy)(foo proxy) THEN undefined # trace back # FI
OD;
PROC raise foo exception x = (FOOOBJECT foo)BOOL:
IF NOT (foo exception x mended OF foo instance)(foo instance) THEN
except foo exception x
FI

View file

@ -1,5 +1,9 @@
...
except foo event:
IF ... THEN # Alas, cannot handle it here continue propagation of #
IF NOT (foo event mended OF foo base)(foo base) THEN undefined # trace back # FI
FI
FOOOBJECTNEW foo instance := foo base; # exception x routines are specific to a foo #
FOOMEND prior foo exception x mend = foo exception x mended OF foo;
on foo exception x(foo instance, raise foo exception x);
WHILE TRUE DO
# now manually raise example "foo exception x" #
raise foo exception x(foo instance)
OD;

View file

@ -1,7 +1,8 @@
PROC raise foo event(REF OBJECTFOO foo)BOOL:
IF mend foo(foo) THEN
TRUE # continue #
ELSE
except foo event
FALSE # OR fall back to default event routine #
FI
on foo exception x(foo instance, prior foo exception x mend);
... EXIT
except foo exception x:
SKIP # exception x caught code here ... #
# to continue to propagate an exception x is a bit more problematic...#
# and requires nesting/restoring prior "raise foo exception x"#
on foo exception x(foo instance, prior foo exception x mend);
raise foo exception x(foo instance)