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

Sys.systemName() should use an enum abstract #6935

Open
Gama11 opened this issue Apr 10, 2018 · 1 comment
Open

Sys.systemName() should use an enum abstract #6935

Gama11 opened this issue Apr 10, 2018 · 1 comment

Comments

@Gama11
Copy link
Member

Gama11 commented Apr 10, 2018

Sys.systemName() returns a raw string for something that only has a set of specific / known values. This is quite error-prone, as can be seen here: #6921. It also means no code completion can be offered.

It would be nice to have a SystemName enum abstract instead that looks something like this:

@:forward @:enum abstract SystemName(String) from String to String {
    var Windows = "Windows";
    var Linux = "Linux";
    var Mac = "Mac";
    // etc..
}

This should preserve full backwards-compatbility due to @:forward and from String to String, while still also allowing the use of values not listed in the abstract.

The only open question is which values should actually be included in the enum... all that are known to be returned by at least one target? Just the most commonly supported ones?


@ncannasse
Copy link
Member

We are supporting the following in HL:

  • "NX" (Nintendo Switch)
  • "PS4" (Sony PS4)
  • "XBoxOne" (MS XBox One)

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

No branches or pull requests

4 participants