IssueRaiser

Rename `anytype` to `anyval`

Sorry, this is kind of nitpicking, but it's been bothering me. The value of a variable of type `anyerror` is some error. The value of a variable of type `anyframe` is some frame. The value of a variable of type `anytype` is usually not a type. Said another way, A variable that holds some unknown error is an `anyerror`. A variable that holds some unknown frame is an `anyframe`. A variable that holds some unknown type is a `type`. A variable that holds some unknown value is an `anytype`? `var` was a bad name because it was overloaded with the mutability specifier. But aside from that, IMO it was an ok name. I don't think we should restore it but I think `anytype` is also confusing. `any` might be a good choice except that it is a common enough variable or function name that the language probably shouldn't reserve it. `infer` was suggested previously, but doesn't convey that the type can change over the variable's lifetime. Maybe `anyvalue`, `anyval`, or `vartype` would be better?

Posted by SpexGuy on Jul 17, 2020, 6:00 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

github (Other)

Rename `anytype` to `anyval`

SpexGuyJul 17, 2020, 6:00 AM

Sorry, this is kind of nitpicking, but it's been bothering me. The value of a variable of type `anyerror` is some error. The value of a variable of type `anyframe` is some frame. The value of a variable of type `anytype` is usually not a type. Said another way, A variable that holds some unknown error is an `anyerror`. A variable that holds some unknown frame is an `anyframe`. A variable that holds some unknown type is a `type`. A variable that holds some unknown value is an `anytype`? `var` was a bad name because it was overloaded with the mutability specifier. But aside from that, IMO it was an ok name. I don't think we should restore it but I think `anytype` is also confusing. `any` might be a good choice except that it is a common enough variable or function name that the language probably shouldn't reserve it. `infer` was suggested previously, but doesn't convey that the type can change over the variable's lifetime. Maybe `anyvalue`, `anyval`, or `vartype` would be better?

Comments (0)

No comments yet. Start the discussion.

Comment on this issue