|Anonymous | Login | Signup for a new account||2020-07-13 00:34 PDT|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002134||Core Inform||Phrases and functional programming||public||2020-06-01 12:12||2020-06-01 12:12|
|Target Version||Fixed in Version|
|Summary||0002134: Compiler sometimes interprets attempt to create definition as a condition if same adjective name used again?|
|Description||The example code shows a situation where the compiler rejects what should presumably be valid code. The same statements are treated as valid and work as expected if the order of definition statements is reversed.|
The problem messages produced (see "Additional Information") seem to imply that the compiler is treating "A flip is OK" in the second definition as a condition test of some kind, and halting because the condition uses the wrong kind as defined in the first definition.
Note that normal behavior (which may or may not be intentional) is to accept use of an adjective not specifically allowed for the kind (and return false by default), as seen when testing whether flips are "marked-out" even though the definition applies only to flaps. If this behavior is not intentional, a second bug report can be submitted.
|Minimal Source Text To Reproduce|
"Definition Conflict" A thingie is a kind of thing. A flip is a kind of thingie. Linking relates one thingie to various thingies. The verb to link means the linking relation. A flap is a kind of thingie. To decide whether (X - a flap) is fine: decide no. [Presence of following definitions causes a problem message. Compiler testing "flap is OK" in second definition as a condition?] Definition: A flip is OK if every thingie linked by it is OK. Definition: A flap is OK if it is fine. [If order of definitions is changed, code works as expected. Uncomment following and comment out previous to observe.] [Definition: A flap is OK if it is fine. Definition: A flip is OK if every thingie linked by it is OK.] Place is a room. Alpha is a flip. [should be OK since it is a flip that links nothing, marked-out definition does not apply since it is a flip] Gamma is a flap. [not OK by definition as a flap, should be marked-out since linked by a flip] Beta is a flip. Beta links gamma. [should be not OK since it links gamma, marked-out definition does not apply since it is a flip.] Delta is a flap. [not OK by definition as a flap, should be not marked-out since linked by nothing] After jumping: repeat with X running through thingies: say "[X] -> [if X is OK]OK[otherwise]not OK[end if]."; Definition: A flap is marked-out if it is linked by a flip. After waving hands: repeat with Y running through thingies: say "[Y] -> [if Y is marked-out]marked-out[otherwise]not marked-out[end if]."; test me with "jump / wave".
|Additional Information||Two problem messages are produced by the example code:|
Problem. You wrote 'A flap is OK if it is fine' , but 'it' is a temporary name for a flip (created by 'let' or 'repeat'), whereas I was expecting to find a flap there.
I was trying to match this phrase:
(it - flap) is fine
it = a temporary named value, holding a flip
Problem. You gave as a definition 'A flap is OK if it is fine' : but that condition makes no sense to me, although the preamble to the definition was properly written. There must be something wrong after 'if'.
See the manual: 6.4 > 6.4. Defining new adjectives
|Tags||No tags attached.|
|Effect||(serious) Compiler rejects valid code|
|2020-06-01 12:12||otistdog||New Issue|
|Copyright © 2000 - 2010 MantisBT Group|