Conversation
|
I would actually prefer |
|
+1 on consistency. |
|
+1 on @kripken's point. It'll be a drag to have to type or even read UInt32 and Uint32Array. /be |
|
I have found it a drag to uncapitalize the I in Uint32 when it's capitalized in Int32, though I am perhaps biased because the convention in LLVM is to capitalize the I in UInt32 :). I won't hold out forever though if there's an overall preference for Uint32 :). It's worth pointing out just for general awareness that we already differ from JS Typed Arrays in the convention of prepending 'S' for signed types, because we distinguish between Signed, Unsigned, and signedness-neutral. And because the U/S creates a nice symmetry and clearly highlights when there are signed vs unsigned things happening. |
Some operators used "Uint32" and some "UInt32". Pick "Uint32" because it's similar to JS Typed Array naming, although we also use "Sint32" which is still different from JS Typed Array naming.
Add an 'S' for signed memory types, and use "Uint32" instead of "UInt32".
9e8ba43 to
272f9c6
Compare
|
Ok, based on feedback here, I updated the patch to prefer lower case after the {S,U}. This seems to generalize to operators as well, so I also renamed Int32SDiv to Int32Sdiv and so on. |
|
FWIW, I prefer UInt32 over Uint32. -Fil
|
|
If clean-slate, I prefer UInt32 also. Holding shift down (LH) while typing U and I (RH) is no less ergonomic and the result is prettier because regular in spelling of `Int. If the slate here is clean enough because Typed Arrays are not closely coupled or in nearby content, no worries on that front. WebAssembly is master of its own naming domain ;-). /be |
|
Ok, a UInt32 version of the patch is available as #93, so we can pick which one we like. |
|
I can see valid reasons for preferring either |
|
@kripken: I agreed with your point in an earlier comment. But will people have to write JS and wasm by hand very often? Sorry to be dense, could you say more about that scenario? /be |
|
wasm probably wouldn't be written by hand much, but it would be read for debugging purposes not infrequently, I think, and in general we care about having a good View Source option for wasm. Imagine someone with a site that uses js and wasm, and debugging some minor issue, through control flow that passes from js to wasm and back. It would feel odd to have |
|
In think case, we don't have much reason to choose one or the other besides consistency with the web platform. Despite wasm being its own master w.r.t. naming, I think we should avoid being different just because, I'd therefore go with the same naming that the web paltform has. |
|
To add a bit more to the Web Platform side: SIMD and Value Types for ES7/2016 will as you'd hope match the Typed Array naming convention, so Uint32, Uint64, etc. I'm back on the Web-first side, FWIW (stable, not flip-flopping again :-P). Our slate is not clean, and LLVM's slate is not overriding compared to the Web standards starting from WebGL, where typed arrays originated. /be |
|
If anything, we want to move away from LLVM because we don't want the impression of a single-compiler spec! LLVM is really important to us, it's probably the first compiler we'll bring up, but we want other compilers on board. |
|
I'm actually going to make the Web Platform argument in opposite direction. Matching the Web Platform for unsigned types makes it even more confusing that we're not matching it on signed types. Also, the argument for UInt32 is not just "because LLVM", it's that it just looks nicer (see multiple comments above). |
I don’t think that being consistent with other specifications is very important. We should just pick what we like. I’ve always thought that the WebGL/ES choice of Uint over UInt was awkward, and it was a rather innovative (ahem) convention. -Filip |
|
@sunfishcode : I don't understand your first paragraph. Where are we matching and we are we not, in the context you mean? |
|
In wasm, signed things have an 'S', to clearly pair them with their 'U' counterparts. And since we have concepts where an Int32 is explicitly signed, explicitly unsigned, and neutral, S-, U-, and plain Int32 is a natural naming scheme to indicate which one we mean. That's incompatible with "Int32" meaning a signed int32. |
|
I see. So JS has However, signed is the "default" in JS, in the sense that
So I would say that The bottom line for me is whether a web developer with an app containing both JS and wasm would prefer to see |
|
I agree with Dan's comment that using s/u/- to mean signed/unsigned/indifferent is a valuable convention. I have a hard time finding an aesthetic preference between |
|
There's a lack of a strong current pulling either way, but I'd really like consistency here, and that requires we make a choice. I'll add one more reason for preferring UInt32 to the reasons above: capital-after-the-{U,S} helps emphasize that the {U,S} are participating in the naming convention of identifying signed/unsigned things. In e.g. "SRem", it's slightly more clear that the abbreviation decomposes to "S" + "Rem". Is this enough to push it over the top? |
|
I agree that is a valid point. But equally compelling to me are arguments that we should just go lowercase: "srem", "sint". This is the most natural to me, likely because of LLVM IR. But it's just a subjective feeling of mine. I could also see an argument for "Srem" to be compelling. I mean, it looks a little odd because I am used to LLVM conventions, but again, that's just a subjective gut feeling of mine. "Srem" is logically consistent in its own way ("signed remainder, and we capitalize just the first letter of the entire operation"), and while it feels odd to me in one way, it feels right in another because of all the times I have written "Sint" on the web. All this was debated when typed arrays were designed for JS, and it could have gone either way. It went the way it did. IMO we should not fork the naming conventions of the web because of how a small number of us here might happen to feel right now. No subjective feeling of ours can be more important than overall consistency in the entire platform, can it? Surely such consistency is an objective value. |
|
I'd be ok with lowercase names too if we can get consensus on that. #122 is a pull request for it. |
|
I would prefer I think that |
|
Can we close this in favor of #122? |
Some places said "Uint32" and some said "UInt32". I picked the latter here from personal preference, though I'm open to other preferences, and mainly just wish the naming to be consistent.
This patch also adds "S" to integer types used with explicit signedness.