formal-semantics

What are Rust's exact auto-dereferencing rules?

一个人想着一个人 提交于 2019-12-10 13:25:06
问题 I'm learning/experimenting with Rust, and in all the elegance that I find in this language, there is one peculiarity that baffles me and seems totally out of place. Rust automatically dereferences pointers when making method calls. I made some tests to determine the exact behaviour: struct X { val: i32 } impl std::ops::Deref for X { type Target = i32; fn deref(&self) -> &i32 { &self.val } } trait M { fn m(self); } impl M for i32 { fn m(self) { println!("i32::m()"); } } impl M for X { fn m

What is “formal semantics”?

a 夏天 提交于 2019-12-04 21:51:05
问题 I'm reading a very silly paper and it keeps on talking about how Giotto defines a "formal semantics". Giotto has a formal semantics that specifies the meaning of mode switches, of intertask communication, and of communication with the program environment. I'm on the edge of, but just cannot quite grasp what it means by "formal semantics." 回答1: Formal semantics describe semantics in - well, a formal way - using notation which expresses the meaning of things in an unambiguous way. It is the

What are Gecko's Javascript interpreter engine semantics?

时光怂恿深爱的人放手 提交于 2019-12-04 20:10:17
问题 Edit In consideration of the answer response below regarding the reference ECMAScript Language Specification - 11.13.2 Compound Assignment Considering why these, javascript: o=""; o = o + (o+=1) ; alert(o); o=""; o = (o+=1) + o; alert(o); are NOT the same. There are temporal semantic issues with left to right script evaluation (ref:ECMA spec. - The addition operator). One consequence is that the + operator is not necessarily commutative. This can also be seen by with: javascript: o=1; o = o +

What are Gecko's Javascript interpreter engine semantics?

你。 提交于 2019-12-03 12:49:13
Edit In consideration of the answer response below regarding the reference ECMAScript Language Specification - 11.13.2 Compound Assignment Considering why these, javascript: o=""; o = o + (o+=1) ; alert(o); o=""; o = (o+=1) + o; alert(o); are NOT the same. There are temporal semantic issues with left to right script evaluation (ref: ECMA spec. - The addition operator ). One consequence is that the + operator is not necessarily commutative. This can also be seen by with: javascript: o=1; o = o + (o+=1) ; alert(o); o=1; o = (o+=1) + o; alert(o); or javascript: o=" _ "; o = o + (o+=1) ; alert(o);

A semantics for Bash scripts?

别说谁变了你拦得住时间么 提交于 2019-11-28 02:41:40
More than any other language I know, I've "learned" Bash by Googling every time I need some little thing. Consequently, I can patchwork together little scripts that appear to work. However, I don't really know what's going on, and I was hoping for a more formal introduction to Bash as a programming language. For example: What is the evaluation order? what are the scoping rules? What is the typing discipline, e.g. is everything a string? What is the state of the program -- is it a key-value assignment of strings to variable names; is there more than that, e.g. the stack? Is there a heap? And so

A semantics for Bash scripts?

徘徊边缘 提交于 2019-11-27 04:57:58
问题 More than any other language I know, I've "learned" Bash by Googling every time I need some little thing. Consequently, I can patchwork together little scripts that appear to work. However, I don't really know what's going on, and I was hoping for a more formal introduction to Bash as a programming language. For example: What is the evaluation order? what are the scoping rules? What is the typing discipline, e.g. is everything a string? What is the state of the program -- is it a key-value

What are Rust's exact auto-dereferencing rules?

社会主义新天地 提交于 2019-11-25 23:58:55
问题 I\'m learning/experimenting with Rust, and in all the elegance that I find in this language, there is one peculiarity that baffles me and seems totally out of place. Rust automatically dereferences pointers when making method calls. I made some tests to determine the exact behaviour: struct X { val: i32 } impl std::ops::Deref for X { type Target = i32; fn deref(&self) -> &i32 { &self.val } } trait M { fn m(self); } impl M for i32 { fn m(self) { println!(\"i32::m()\"); } } impl M for X { fn m

What are the precise semantics of block-level functions in ES6?

瘦欲@ 提交于 2019-11-25 23:09:52
问题 I\'m trying to wrap my head around the new standardized block-level functions in ES6 by reading the raw spec. My superficial understanding was: Block-level functions declarations are allowed in ES6. They hoist to the top of the block. In strict mode, they aren\'t visible outside the containing block. However, this is further complicated by the fact that part of these semantics are specified to be \"optional\" and only mandatory for web browsers (Annex B). So I would like have the following