(no title)
jawzz | 3 years ago
If you think about it, when you solve a physics problem, for instance, you call every mass “m1”, “m2”, etc. Maybe this would be another step in Go’s direction of conforming style to make code more standard and readable.
gbalduzzi|3 years ago
However, in many cases a more descriptive name is way appropriate. On top of my mind:
- Multiple variables of the same type. How are you supposed to distinguish between req and req2? Compare it to something like "apiReq" and "cdnReq"
- Primitive types, that does not inherently carry a domain value. An integer called "seconds" or "max_offset" has a lot more meaning that one named "num"
Forcing such a notation into the language would make impossibile to represent all these cases
jawzz|3 years ago
If you were just coding physics problems you could have types restricted to the physics domain, that is, physical units. Which it looks like MATLAB does now support: https://www.mathworks.com/help/symbolic/units-of-measurement...
gogogogogogo|3 years ago
I've been writing Go cloud stuff for the better part of a decade and "req" for a request has never been ambiguous because I go ahead and send the request and process the response before sending another one, at which point I can just reassign the variable and let the first one fall out of scope.
notpushkin|3 years ago
jawzz|3 years ago
Too|3 years ago
For sensitive infrastructure this makes sense, i surely wouldn't want to write other code like this.
Ferret7446|3 years ago
leetrout|3 years ago
The idea of having a standard library of types related to what are effectively program keywords... could be really good. Or hideous like global vars.
I wonder if any language has tried this?
vlunkr|3 years ago