Consider the following code:
#![allow(dead_code)]
fn f (x: &mut i32) -> &mut i32 { x }
fn id<T>(x: T ) -> T { x }
fn main() {
let mut x = 10;
let m = &mut x;
/* barriers.h --- interface to memory and code translation barriers */ | |
#ifndef MN__GC_BARRIERS_H | |
#define MN__GC_BARRIERS_H | |
/* The following two functions provide the memory-coherence behavior | |
of mutexes, but without any blocking or communication. | |
On many modern multi-threaded systems, one thread may see writes to |
//! Generators in Rust, simulated at great expense using threads | |
//! | |
//! Here's a generator which yields the numbers from one to three: | |
//! | |
//! let gen = generate(|(), out| { | |
//! for i in 1..4 { | |
//! out.yield_(i); | |
//! } | |
//! }); | |
//! |
Consider the following code:
#![allow(dead_code)]
fn f (x: &mut i32) -> &mut i32 { x }
fn id<T>(x: T ) -> T { x }
fn main() {
let mut x = 10;
let m = &mut x;
If you say "T is a subtype of U", that means that whenever someone wants a U, a T will do: every T works as a U. It follows from this phrasing that U is a subtype of U: certainly if someone wants a U, a U will do.
So if you imagine a type as denoting a set of values, you can write: T ⊆ U.
If every T works as a U, then a function that accepts any U is certainly also a function that accepts any T:
fn(U)
works as a fn(T)
.
So fn(U)
is a subtype of fn(T)
: fn(U)
⊆ fn(T)
.
This is interesting, because the subtypedness gets reversed: T ⊆ U implies fn(U)
⊆ fn(T)
.
;;; edit-js-fn.el --- Edit JS_FN_HELP sections in SpiderMonkey shell files | |
;; See js-fn-edit-documentation. | |
(defvar js-fn-edit-original-buffer nil | |
"The buffer to which a js-fn-edit-mode buffer will store the edited text.") | |
(defvar js-fn-edit-original-region nil | |
"The region of js-fn-edit-original-buffer the original definition occupies.") |
import random | |
random.seed() | |
def flip(): | |
return random.choice([True, False]) | |
def run(): | |
b = flip() | |
n = 1 |
<body> | |
<form id='myform' x="form's attr x"> | |
<input id='mybutton' type='button' y="button's attr y" | |
onclick='console.log("hi, " + x + ", " + y); log_this(); log_that();'> | |
</input> | |
</form> | |
<script> | |
var form = window.document.getElementById('myform'); | |
form.x = "form's property x"; |
let obj = { f: function() { console.log(this === obj); } }; | |
with (obj) f(); | |
// output: true |
/// https://en.wikipedia.org/wiki/Euler_angles | |
struct EulerAngle3<R> { α: R, β: R, γ: R } | |
struct Point<R> { x: R, y: R, z: R } | |
struct Pin<R> { | |
/// The location of the pin's center of gravity. | |
center: Point<R>, | |
/// The angle with the positive Z axis of some distinguished point | |
/// on the pin that is off the pin's axis of symmetry. | |
orientation: EulerAngle3<R> |
diff --git a/mfbt/Vector.h b/mfbt/Vector.h | |
--- a/mfbt/Vector.h | |
+++ b/mfbt/Vector.h | |
@@ -158,17 +158,22 @@ struct VectorImpl | |
*/ | |
template<typename T, size_t N, class AP> | |
struct VectorImpl<T, N, AP, true> | |
{ | |
template<typename... Args> | |
MOZ_NONNULL(1) |