Comments (9)
response = (status = ST_SUCCESS);
should be
response = (status = ST_SUCCESS,);
to indicate that its a tuple.
Sorry for this weirdness :)
from p.
We should mention this in the language manual ...
from p.
Is there a fundamental reason for this weirdness or just laziness in the parsing :-) ?
from p.
It looks like P is in elite company. Rust takes the same approach. See the code on lines 42 and 43 here.
I suppose explaining the issue in the documentation should be adequate.
from p.
There isnt an easy way to distinguish between a named tuple value (with single field in it) and parenthesis around a value: basically, we need the comma for the parser to distinguish between (5)
and (5,)
first is a value 5
and second is a tuple with one element 5
of type int
. Not sure how to fix this without changing the way we represent tuple values. Any suggestions :)
from p.
Haha. Thanks for this pointer. Now people will no longer complain, as we can say we are same Rust ;). Elite club.
from p.
Thanks, it works!
Just to mention, such syntax can be seen in Python code too - so it's not that weird, one just has to remember about it. 😅
from p.
But I still find it weird that the error is reported in the parsing stage (and the error message is not helpful either). I would have expected parsing to succeed but type checking to fail with a better error message.
from p.
@shazqadeer the parsing fails response = (status = ST_SUCCESS);
as in this case (status = ST_SUCCESS)
gets parsed as an assignment statement and we then the parser starts complaining, I need to think about how this can help fixed.
from p.
Related Issues (20)
- Emacs support for editing P files HOT 3
- VSCode extension syntax highlighting not working HOT 2
- Tutorial - Client/Server - Error: "'PMonitor' does not contain a definition for 'TryRandom'" HOT 2
- Tutorial - "Error: Failed to get test method '' from assembly 'ClientServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' " HOT 4
- Installation instructions should say you need nuget as a dotnet source HOT 1
- Grammar railroad diagram HOT 1
- [docs] compositional programming: docs and examples? HOT 1
- [docs] State machine event handler semantics: atomic execution? HOT 6
- `GuaranteedWithDrawProgress` in Tutorial 1 is inaccurate/misdocumented HOT 4
- Internal Error: No such file or directory HOT 1
- In trace logs enums are printed as integers and its annoying!
- Infinite loop in Timer module HOT 3
- Case expressions HOT 1
- Assert's error message is eagerly evaluated HOT 2
- Upgrade to Newer .Net Version HOT 1
- T
- High quality P Icon HOT 2
- "defer" and "ignore" statements not documented HOT 1
- Feature request: machine-local types HOT 1
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 p.