mirror of
https://github.com/ganelson/inform.git
synced 2024-06-29 05:24:57 +03:00
Implemented +replacing for non-functions
This commit is contained in:
parent
839aec2a7f
commit
a1e6b9e7ab
|
@ -1,6 +1,6 @@
|
||||||
# Inform 7
|
# 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
|
## About Inform
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Prerelease: beta
|
Prerelease: beta
|
||||||
Build Date: 9 October 2022
|
Build Date: 10 October 2022
|
||||||
Build Number: 6V80
|
Build Number: 6V81
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "BasicInformExtrasKit",
|
"title": "BasicInformExtrasKit",
|
||||||
"version": "10.2.0-beta+6V80"
|
"version": "10.2.0-beta+6V81"
|
||||||
},
|
},
|
||||||
"kit-details": {
|
"kit-details": {
|
||||||
"has-priority": 1
|
"has-priority": 1
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "BasicInformKit",
|
"title": "BasicInformKit",
|
||||||
"version": "10.2.0-beta+6V80"
|
"version": "10.2.0-beta+6V81"
|
||||||
},
|
},
|
||||||
"needs": [ {
|
"needs": [ {
|
||||||
"unless": {
|
"unless": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "CommandParserKit",
|
"title": "CommandParserKit",
|
||||||
"version": "10.2.0-beta+6V80"
|
"version": "10.2.0-beta+6V81"
|
||||||
},
|
},
|
||||||
"needs": [ {
|
"needs": [ {
|
||||||
"need": {
|
"need": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "EnglishLanguageKit",
|
"title": "EnglishLanguageKit",
|
||||||
"version": "10.2.0-beta+6V80"
|
"version": "10.2.0-beta+6V81"
|
||||||
},
|
},
|
||||||
"needs": [ {
|
"needs": [ {
|
||||||
"need": {
|
"need": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "WorldModelKit",
|
"title": "WorldModelKit",
|
||||||
"version": "10.2.0-beta+6V80"
|
"version": "10.2.0-beta+6V81"
|
||||||
},
|
},
|
||||||
"needs": [ {
|
"needs": [ {
|
||||||
"need": {
|
"need": {
|
||||||
|
|
|
@ -232,6 +232,7 @@ the result, declare a symbol for it, and then define that symbol.
|
||||||
|
|
||||||
inter_symbol *made_s;
|
inter_symbol *made_s;
|
||||||
@<Declare the Inter symbol for what we will shortly make@>;
|
@<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))
|
if ((directive == ATTRIBUTE_PLM) || (directive == PROPERTY_PLM))
|
||||||
@<Declare a property ID symbol to go with it@>;
|
@<Declare a property ID symbol to go with it@>;
|
||||||
|
|
||||||
|
|
|
@ -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
|
...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 (-
|
Include (-
|
||||||
+replacing [ SquareRoot num;
|
+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"`,
|
This is, in a sense, not a new ability since it was already possible to write:
|
||||||
the previous best way to do this.) Either way, given something like:
|
|
||||||
|
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:
|
When play begins:
|
||||||
showme the square root of 100.
|
showme the square root of 100.
|
||||||
|
|
Loading…
Reference in a new issue