Comments (5)
Expressions should be valid there. This is a code generation bug.
(In the line give obj 1 + 1
, the expression gets folded to a constant at compile time. That's why the bug doesn't show up.)
from inform6.
Whoops, hang on, I'm wrong about what happened.
The line give obj (1);
is parsed as give X;
where X is a function call obj(1)
. That's the ambiguity you were referring to. It's confusing because give X;
is legal, according to the language def -- it gives the object X zero attributes.
Yeah, it's not obvious how to even detect this. We could warn on give X;
but then the same problem occurs with give obj (1) light;
.
Maybe the call syntax X(Y)
can do some static type-checking.
from inform6.
On the other hand, the compiler should never produce an invalid file without complaining.
This is not a rule at all, I'm afraid. There are an infinite number of ways to produce an invalid story file. Calling X()
where X is not a function is just one of them.
from inform6.
Ah, I didn't know it was possible to have a give
statement without attributes. (And I also totally forgot about constant folding.)
In that case, yeah, the syntax is ambiguous but the compiler isn't wrong either, so I guess it's not a bug after all. (Although I would have thought interpreters would display an error message in the lines of "tried to call something that's not a routine".)
I suppose that, as you said, it should be possible to type-check routine calls, but that's not extremely important either.
from inform6.
#172 is the routine-call type check.
line 12: Warning: In function call, expected Routine but found Object "obj"
> give obj (1+1);
Of course this warning only appears when obj
is an Object literal. If it's a local variable, the compiler can't help you.
from inform6.
Related Issues (20)
- "Global self = 1" ignores default value HOT 2
- inform6 6.41-r1 linux build failure HOT 1
- Label vs constant conflict HOT 5
- Error is reported in wrong file + line HOT 4
- Option to skip the symbol names table HOT 4
- Orphan grammar-lines HOT 4
- Error-check for max property length in v3
- Reject quoted local variables HOT 2
- Constant expressions in switch cases HOT 4
- Create ebf_token_error(), call it in most places
- RA_Pr contains incorrect formula for z3 HOT 19
- Unclosed double-quote at the end of a source file hangs the compiler HOT 2
- Problem with RL__Pr HOT 1
- Platform-independent linefeed handling HOT 3
- Compiled game mismatch on ARM HOT 8
- inform6 fails to build under termux/llvm clang HOT 5
- Failure to find value of replaced procedure HOT 4
- Failure related to switch/case handling when compiling with library 6/12 HOT 3
- put_token_back() does not revert symbols HOT 1
- Putting quote in single quotes causes a compilation error HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inform6.