Comments (13)
For those of use who don't use stack, what GHC version is included in "LTS 7.14"?
Update: You also don't mention what version of alex. I fixed a number of issues like this about 3 months ago.
from alex.
I'm not a fan of -Wname-shadowing
and I normally turn it off. What exactly does --pedantic
do, and when do you encounter these errors? When building Alex itself, or something that uses Alex?
from alex.
LTS 7.14 uses GHC 8.0.1 and alex-3.1.7 (see https://www.stackage.org/lts-7.14)
pedantic: turn on all warnings and errors (in ghc and all other programs used to build)
I am building my own Name.x files.
Yet, their compilation uses some template files of Alex that cause the warning
(that is considered an error due to pedantic)!
Checking for name-shadowing can prevent unexpected behavior.
We once had an issue with a variable called map and the map function.
from alex.
@pjljvandelaar Alex is currently at version 3.2.1 and I think at least some of those warnings have been fixed.
@simonmar I got caught a couple of times in C code with name shadowing and started passing -Wshadow
to gcc well over a decade ago. When took up Haskell I was very pleased to notice that the name shadowing warning is part of -Wall
so I don't have to remember to set it. For things like the Alex template files, it would be a good idea for them to be as warning clean as possible so that the Alex user can turning on as many warnings as they feel comfortable with and see (hopefully) zero warnings from the template code.
from alex.
I agree with the fact that some warnings have been fixed (as was already mentioned in the first message)
I also agree with having the alex template files as warning clean as possible!
Solving name-shadowing is relatively easy.
We often just append the name with ' to make it unique.
from alex.
I found that the tests are currently building with -fno-warn-name-shadowing
so that these warnings are not being triggered at during cabal test
. Working on fixing that.
from alex.
I'm well aware that accidental shadowing can cause unexpected bugs. But deliberate shadowing can also be used to prevent bugs, which is why I personally prefer to leave the warning turned off. That and the fact that I often like to use id
as a variable name :)
But I'm not against avoiding warnings in template code, by all means go ahead.
from alex.
@erikd In which version of alex will this bug be fixed?
from alex.
Problem keeps returning:
templates\wrappers.hs:448:25: warning: [-Wname-shadowing]
This binding for `str' shadows the existing binding
bound at templates\wrappers.hs:447:16
Please fix the template code !
from alex.
I'm not sure how sustainable this is, but I've fixed the shadowing warnings.
from alex.
You can enforce it by using the flags -Wall -Werror on your code
or
You can add tags for the Haskell compiler to your templates such that the compiler doesn't complain.
from alex.
Thanks!
from alex.
@pjljvandelaar I know about the flags :) Indeed the tests are run with -Wall -Werror
, and I just removed -fno-warn-name-shadowing
, so this won't break again.
The reason I say it isn't sustainable is that Alex appends some template code to the module, so there will inevitably be name clashes. There's no way I can pick a local name in the Alex template code that is guaranteed not to shadow anything in the user code. I've made the names unlikely to clash, but there's no guarantee.
from alex.
Related Issues (20)
- New release HOT 3
- alex 3.2.7 fails to parse definitions which can pass alex 3.2.6 HOT 13
- How to build `alex` from git sources? Instructions in `README.md` are broken. HOT 3
- Agda-style Lexing HOT 3
- website (bad link) HOT 10
- Makefile (examples) HOT 2
- UTF-8 and text 2.0 HOT 2
- spelling of `DFS.GForrest` HOT 3
- Make `haskell.org/alex` redirect to `haskell-alex.readthedocs.io` ? HOT 6
- `alexSetUserState`/`alexGetUserState` with `monadUserState-bytestring` wrapper HOT 6
- Alex PVP violation? HOT 2
- Function `Util.brack` is not used
- Functions `Sort.isort` and `Sort.insrt` not used HOT 2
- Is module DFS really needed? HOT 2
- Deriving Ord for AlexPosn HOT 4
- upgrading problems with Cabal HOT 3
- Alex generates code that cannot be compiled by GHC 9.2 HOT 13
- Add option `--numeric-version`
- Unused `import Data.Char` in `basic-bytestring` lexer HOT 2
- Alex generates code with unqualified imports, e.g. of `GHC.Exts`
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 alex.