Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shakespeare escape bug in #\" #251

Open
ncaq opened this issue Mar 10, 2020 · 2 comments
Open

shakespeare escape bug in #\" #251

ncaq opened this issue Mar 10, 2020 · 2 comments

Comments

@ncaq
Copy link
Contributor

ncaq commented Mar 10, 2020

There is a bug in the escaping of shakespeare.

I think to should be to use jsFile,
However, jsFile = juliusFile.

I write to Shakespeare/test/Text/Shakespeare/TextSpec.hs

    it "Non-expression sharps do not hinder backslash" $ do
      telper "#\\\"" [text|#\"|]

It has been reproduced.
It is a deep problem because.

This is a real string.

https://github.com/facebook/react/blob/50addf4c0e411e351de7290c8c60ec775c25c8c4/packages/react-reconciler/src/ReactDebugFiberPerf.js#L103

is bundled in webpack development.

in eval

#$\" + debugID + \"

My quick-fix

rawJsFile :: FilePath -> Q Exp
rawJsFile fp = do
  fileString <- readFileRecompileQ fp
  [|rawStringToJavascript fileString|]

rawStringToJavascript :: String -> Javascript
rawStringToJavascript = toJavascript . rawJS

The reload version of the function can only be written inside shakespeare, so there is nothing I can do about it.

I tried to find a way to fix this bug, but I couldn't find it.

Proposal

I suggest adding rawJsFile which adds JS without embedding anything.

Some users mistakenly think that the contents of both jsFile and juliusFile are different.
It is suggested that the jsFile system be deprecated.

Even after the bug is fixed, there are some people who don't want to embed variables but want to embed JavaScript files.

@snoyberg
Copy link
Member

There's a lot of stuff here which seems contradictory. Is this actually a bug, or "this isn't behaving the way I expected it to?"

I'm OK with the proposal overall to reduce confusing names via deprecation, and to add a new piece of functionality. I just want clarity on whether there's an actual bug here versus confusing language.

@ncaq
Copy link
Contributor Author

ncaq commented Mar 13, 2020

This is bug.
The string literal quote " in string literal must be escape.
webpack escape it.
However julius remove backslash when prefix sharp.
So I import react, and it occur syntax parse error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants