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

RFC: represent all litterals as string #127

Closed
timotheecour opened this issue Apr 26, 2020 · 0 comments
Closed

RFC: represent all litterals as string #127

timotheecour opened this issue Apr 26, 2020 · 0 comments

Comments

@timotheecour
Copy link
Owner

timotheecour commented Apr 26, 2020

literals-as-strings

this was discussed in forum recently (EDIT: not sure how to find it D20200425T182934; EDIT: https://irclogs.nim-lang.org/02-04-2020.html#12:45:32); the idea is to make the parser emit litterals (eg 123, 123'u8, 23.4, -34 etc) as strings instead of doing the parsing there; and the parsing would be deferred to semcheck phase

benefits

alternatives considered

links

D20200425T180920

info

more discussion

(around https://irclogs.nim-lang.org/02-04-2020.html#12:31:25)

  • strings really seem like the most sane option here.
  • nimpretty, arbitrarily big custom int literals, fixing the -128 issue
  • in the macro system we already have an 'intVal' accessor, we can do the parsing in there
  • as 1000 loses information over 1_000'i32
  • parsing them in the lexer is a hack really, nimpretty needs to extract the numbers back from the original source code

open questions

  • how to deal with backward compatibility
  • how to deal with existing macros

EDIT

migrated to nim-lang/compilerdev#7

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

1 participant