Skip to content

Renaming NumericLiteral to NumberLiteral? #3104

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

Closed
jbondc opened this issue May 10, 2015 · 7 comments
Closed

Renaming NumericLiteral to NumberLiteral? #3104

jbondc opened this issue May 10, 2015 · 7 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@jbondc
Copy link
Contributor

jbondc commented May 10, 2015

There's currently a NumericLiteral:
https://github.com/Microsoft/TypeScript/blob/master/src/compiler/types.ts#L23

And a numberIndex:
https://github.com/Microsoft/TypeScript/blob/master/src/compiler/types.ts#L1507

I'm trying to add:

    export interface NumberSetType extends Type  {
        start: number;
        end: number;
        /* @internal */
        sparseValues?: number[];
    }

Should this be called a NumericSetType?

My preference would be to rename NumericLiteral to NumberLiteral, and keeping NumericLiteral as backwards compat. Is that too much of a big change?

@DanielRosenwasser
Copy link
Member

This would be a pretty major change. What are you trying to achieve?

@jbondc
Copy link
Contributor Author

jbondc commented May 10, 2015

Just consistent naming, is NumericSetType or NumberSetType better?

It's related to #1003 and new proposal #3105

@DanielRosenwasser
Copy link
Member

I'd prefer it stayed NumericLiteral. That said, I would proceed with caution, since the proposal itself hasn't been discussed by the team yet.

@DanielRosenwasser DanielRosenwasser added the Question An issue which isn't directly actionable in code label May 11, 2015
@CyrusNajmabadi
Copy link
Contributor

ES5 specifies this as NumericLiteral. What is NumberSetType supposed to represent? Without knowing, it's not possible to make a good name for it.

@jbondc
Copy link
Contributor Author

jbondc commented May 12, 2015

@CyrusNajmabadi See here:
4dc4814

I could use your input to 'scan a numeric literal', it's awkward code right now because of scanner compat with JS:
4dc4814#diff-ead24f0f0f59c0ea9c1c511052e8884bR2234

@DanielRosenwasser
Copy link
Member

You'd probably have to search for a numeric literal, a ... token and another numeric literal. That said, since 1. is a valid numeric literal and so is .3, you couldn't write 1...3, you'd have to write 1.....3 or have separators like 1 ... 3 or (1)...(3).

I'll reiterate my word of caution - if you're intent on presenting a proof of concept, then that's great - we love to see when people can do cool stuff with the compiler. Experimenting is a great way for both you and us to learn. We can help answer questions about the internals and give you some guidance, but we can't make any guarantees over whether we're willing to put something like this into the language without further discussion.

@CyrusNajmabadi
Copy link
Contributor

Yeah, i'm with Dan on this. The lexical ambituities are going to be a bit obnoxious to have to deal with. Note that you'd actually have to write 1....3 (i.e. 4 dots). That's because 1. would be one lexeme. Then ... would be the next. Then 3 would be the last.

I'd recommend some other piece of syntax (tbh, i'm not sure why 1-3 wouldn't work, given you're in a type position).

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

3 participants