1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-05-17 16:38:40 +03:00

Implemented +replacing for non-functions

This commit is contained in:
Graham Nelson 2022-10-10 09:50:20 +01:00
parent 839aec2a7f
commit a1e6b9e7ab
9 changed files with 31 additions and 11 deletions

View file

@ -1,6 +1,6 @@
# Inform 7
[Version](notes/versioning.md): 10.2.0-beta+6V80 'Krypton' (9 October 2022)
[Version](notes/versioning.md): 10.2.0-beta+6V81 'Krypton' (10 October 2022)
## About Inform

View file

@ -1,3 +1,3 @@
Prerelease: beta
Build Date: 9 October 2022
Build Number: 6V80
Build Date: 10 October 2022
Build Number: 6V81

View file

@ -2,7 +2,7 @@
"is": {
"type": "kit",
"title": "BasicInformExtrasKit",
"version": "10.2.0-beta+6V80"
"version": "10.2.0-beta+6V81"
},
"kit-details": {
"has-priority": 1

View file

@ -2,7 +2,7 @@
"is": {
"type": "kit",
"title": "BasicInformKit",
"version": "10.2.0-beta+6V80"
"version": "10.2.0-beta+6V81"
},
"needs": [ {
"unless": {

View file

@ -2,7 +2,7 @@
"is": {
"type": "kit",
"title": "CommandParserKit",
"version": "10.2.0-beta+6V80"
"version": "10.2.0-beta+6V81"
},
"needs": [ {
"need": {

View file

@ -2,7 +2,7 @@
"is": {
"type": "kit",
"title": "EnglishLanguageKit",
"version": "10.2.0-beta+6V80"
"version": "10.2.0-beta+6V81"
},
"needs": [ {
"need": {

View file

@ -2,7 +2,7 @@
"is": {
"type": "kit",
"title": "WorldModelKit",
"version": "10.2.0-beta+6V80"
"version": "10.2.0-beta+6V81"
},
"needs": [ {
"need": {

View file

@ -232,6 +232,7 @@ the result, declare a symbol for it, and then define that symbol.
inter_symbol *made_s;
@<Declare the Inter symbol for what we will shortly make@>;
CompileSplatsStage::apply_annotations(SplatInstruction::I6_annotation(P), made_s);
if ((directive == ATTRIBUTE_PLM) || (directive == PROPERTY_PLM))
@<Declare a property ID symbol to go with it@>;

View file

@ -37,7 +37,16 @@ implemented. So for example, placing this function in (say) `ExampleKit`...
];
...causes it to replace the more arithmetical definition of a function with
the same name in `BasicInformKit`. Equally, source text for a project could say:
the same name in `BasicInformKit`. More specifically:
+replacing(from BasicInformKit) [ SquareRoot num;
"Nobody cares about square roots, son.";
];
replaces the definition if it occurs in `BasicInformKit` but not from anywhere
else. This all gives kits an ability to make replacements which they didn't
previously have. The same annotation can also be used in the source text for
a project:
Include (-
+replacing [ SquareRoot num;
@ -45,8 +54,18 @@ the same name in `BasicInformKit`. Equally, source text for a project could say:
];
-).
(Note that this use of `Include` does not end with `replacing "SquareRoot"`,
the previous best way to do this.) Either way, given something like:
This is, in a sense, not a new ability since it was already possible to write:
Include (-
[ SquareRoot num;
"Nobody cares about square roots, son.";
];
-) replacing "SquareRoot".
But the new notation allows individual definitions to be marked as replacements
and makes it much easier to make long runs of replacements.
The effect of all of these alternatives is that given something like:
When play begins:
showme the square root of 100.