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

Spell out the "literal" operators. #380

Merged
merged 4 commits into from
Oct 2, 2015
Merged

Spell out the "literal" operators. #380

merged 4 commits into from
Oct 2, 2015

Conversation

sunfishcode
Copy link
Member

Also, remove a broken link to the binary encoding page. The binary
encoding is not yet determined, but AstSemantics.md doesn't need to
reference it right now anyway.

See also WebAssembly/spec#88

Also, remove a broken link to the binary encoding page. The binary
encoding is not yet determined, but AstSemantics.md doesn't need to
reference it right now anyway.
@lukewagner
Copy link
Member

Looks good to me, although I wonder if we could get by with the slightly more compact lit.

@sunfishcode
Copy link
Member Author

I'm ok with lit myself.

@rossberg
Copy link
Member

A bit more terminology nitpicking from me :) : "literal" usually refers to the textual representation of something. Again this is not really the right level to talk about these opcodes. I would rather call them constants.

@sunfishcode
Copy link
Member Author

"Constant" means unchanging, which can include local variables or other things. "Literals" (or even "immediates") properly express the property that the value is being provided immediately with the instruction.

@rossberg
Copy link
Member

rossberg commented Sep 29, 2015 via email

@sunfishcode
Copy link
Member Author

I frequently use "constant" as a noun to refer to non-immediate constants. If "literal" sounds too much like a text thing, that's why it's my second choice after "immediate" ;).

* `i32.literal`: produce the value of an i32 immediate
* `i64.literal`: produce the value of an i64 immediate
* `f32.literal`: produce the value of an f32 immediate
* `f64.literal`: produce the value of an f64 immediate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we explicitly point out that this preserve NaN sign, signal/quiet, and payload?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable. I added a mention of NaN values of all possible bit patterns.

WebAssembly presently has no concept of signaling vs. quiet NaN, so I think it's sufficient to just say all possible bit patterns.

@jfbastien
Copy link
Member

lgtm with either term.

I'll suggest cons and walk away slowly.

@ghost ghost mentioned this pull request Sep 29, 2015
@rossberg
Copy link
Member

On 29 September 2015 at 21:20, JF Bastien notifications@github.com wrote:

I'll suggest cons and walk away slowly.

That would of course have very confusing connotations with the major
S-expression languages. But with that extra t I'd be happy. :)

FWIW, 'constant' also is the terminology that both the JVM (ldc and
{i,l,f,d}const instructions) and the CLR (ldc instruction) use in this
context.

@jfbastien
Copy link
Member

I'll suggest cons and walk away slowly.

That would of course have very confusing connotations with the major
S-expression languages. But with that extra t I'd be happy. :)

If that wasn't clear, I was trolling FP programmers, and it looks like I hit my mark dead on :-)

May I instead suggest we use :: ?

@titzer
Copy link

titzer commented Oct 1, 2015

"const" also sounds fine to me. v8-native-prototype uses internal names
"I8Const", "I32Const", etc.

On Wed, Sep 30, 2015 at 5:26 PM, rossberg-chromium <notifications@github.com

wrote:

On 29 September 2015 at 21:20, JF Bastien notifications@github.com
wrote:

I'll suggest cons and walk away slowly.

That would of course have very confusing connotations with the major
S-expression languages. But with that extra t I'd be happy. :)

FWIW, 'constant' also is the terminology that both the JVM (ldc and
{i,l,f,d}const instructions) and the CLR (ldc instruction) use in this
context.


Reply to this email directly or view it on GitHub
#380 (comment).

@sunfishcode
Copy link
Member Author

Ok. I added a patch to this PR to use const.

@jfbastien
Copy link
Member

lgtm, though it's a bit confusion to talk about immediates in the English text, and const as the opcode and header :)

@sunfishcode
Copy link
Member Author

The value is given in an immediate field of the const instruction :).

@rossberg
Copy link
Member

rossberg commented Oct 2, 2015

lgtm. Thanks!

sunfishcode added a commit that referenced this pull request Oct 2, 2015
Spell out the "literal" operators.
@sunfishcode sunfishcode merged commit 43b02ab into master Oct 2, 2015
@sunfishcode sunfishcode deleted the literal branch October 2, 2015 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants