• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2


Commit MetaInfo

Revisióncf689514c152fa862deb4b94422f2a1468d9bb13 (tree)
Tiempo2023-09-23 03:02:58
AutorAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

ASIS

Cambiar Resumen

Diferencia incremental

diff -r 927aca47d9a4 -r cf689514c152 castle/aigr/__init__.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/castle/aigr/__init__.py Fri Sep 22 20:02:58 2023 +0200
@@ -0,0 +1,5 @@
1+# (C) Albert Mietus, 2023. Part of Castle/CCastle project
2+
3+
4+
5+
diff -r 927aca47d9a4 -r cf689514c152 castle/aigr/events.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/castle/aigr/events.py Fri Sep 22 20:02:58 2023 +0200
@@ -0,0 +1,16 @@
1+# (C) Albert Mietus, 2023. Part of Castle/CCastle project
2+
3+from dataclasses import dataclass, KW_ONLY
4+
5+from castle.auxiliary import AIGR
6+
7+@dataclass # pragma: no mutate
8+class Event(AIGR):
9+ """An event is like a (remote) function-call
10+
11+ It has a name, a return-type (can be void), and a sequence of typed parameters."""
12+
13+ name: str
14+ _: KW_ONLY # The field below must be passed as keywords, when initialising
15+ return_type: type=None
16+ typedParameters: Sequence[CC_TypedParameter]=() ## A tuple `()` is inmutable
diff -r 927aca47d9a4 -r cf689514c152 castle/auxiliary/aigr.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/castle/auxiliary/aigr.py Fri Sep 22 20:02:58 2023 +0200
@@ -0,0 +1,7 @@
1+"XXX DocMe"
2+
3+class AIGR: # Abstract Intermediate Graph Representation
4+ def __new__(cls, *args, **kwargs):
5+ if cls == AIGR:
6+ raise NotImplementedError(f"Instantiate a subclass of {cls}, not the `Abstract Intermediate Graph Representation`` itself")
7+ return super().__new__(cls)
diff -r 927aca47d9a4 -r cf689514c152 pytst/auxiliary/test_2_AIGR.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pytst/auxiliary/test_2_AIGR.py Fri Sep 22 20:02:58 2023 +0200
@@ -0,0 +1,17 @@
1+# (C) Albert Mietus, 2023. Part of Castle/CCastle project
2+
3+from castle.auxiliary import AIGR
4+
5+class Demo(AIGR):
6+ pass
7+
8+def test_noAIGR():
9+ try:
10+ AIGR()
11+ assert False , "shouldn't be able to initiate an AIGR directly"
12+ except NotImplementedError:
13+ pass
14+
15+def test_AIGR_sub():
16+ d = Demo()
17+ assert isinstance(d, AIGR)