Comments (9)
To be honest, I think the latter (n-1
not parsing) is a feature, not a bug :) I am happy with nudging people to use whitespace.
from effekt.
Note, this is still the case on current master.
Also, similarly: n-1
lexes as n
-1
(not as n
-
1
) and fails during parsing.
from effekt.
Just tagging @dvdvgt since this might be relevant for him.
from effekt.
I fail to see what we can do about it to completely avoid this issue:
- Either disallow
!
occurring in identifiers, - force the user to add a space
- or have it the other way around such that there may be a falsely lexed
!=
where it is actually an identifier ending with a!
.
How else should the lexer know that val n!=1
contains the identifier n!
and and the token =
but not !=
instead without taking the context into consideration?
from effekt.
Also, similarly:
n-1
lexes asn
-1
(not asn
-
1
) and fails during parsing.
This should be fixable by allowing the lexer only to lex unsigned numbers and let parser figure out the precedence.
from effekt.
As I said, I wouldn't want to fix this. People should use whitespaces if they mean n - 1
.
from effekt.
As much as I like the frequent and consistent use whitespaces to structure code, I disagree. I don't think arithmetics is the right place to force this onto the user. Parsing should be robust enough to handle something like 1-1
(instead of 1 - 1
) without aborting the whole compilation.
from effekt.
As I said, I wouldn't want to fix this. People should use whitespaces if they mean
n - 1
.
I'm somewhat fine with this (though I sometimes do prefer the version without whitespace), but then we should be consistent and also disallow n- 1
(which is parsing fine).
from effekt.
The easiest way to disallow it is to allow - as part of an identifier ;)
from effekt.
Related Issues (20)
- Tests for `exception` stdlib. HOT 1
- [To be discussed] Allow match guards as boolean expressions
- Rename constructors of collections HOT 1
- Wrong primitive names in LLVM I/O HOT 2
- String-related problems on the LLVM backend HOT 5
- Top-level constants in the LLVM backend
- `equals` does not work properly in chez Backends
- Convention for error reporting and aborting HOT 1
- Store string literals in their unescaped form HOT 6
- Functions outside of the event loop segfault on LLVM
- Overeager JS inliner forgets to parenthesize HOT 1
- Consistently name generated ML binary
- Support for prefix operators HOT 5
- `array::copy(from, start, to, offset, length)` copies one element more
- References escape their region when using `var` HOT 1
- More descriptive comments when generating LLVM from Machine
- Unexpected end of input on opening brace after newline HOT 1
- Existentially quantified types are defined in outer scope HOT 2
- Investigate using memory use markers in the generated LLVM
- Renamer stack-overflows on large test suites 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 effekt.