Skip to content

Instantly share code, notes, and snippets.

View jorendorff's full-sized avatar

Jason Orendorff jorendorff

View GitHub Profile
function wetA() {};
function wetB() {};
wetB.prototype = new wetA();
var wet_b = new wetB();
// Reflect.get(wetB, "prototype") === Reflect.getPrototypeOf(wet_b);
// boilerplate, not really that important
function valueType(value) {
if (value === null)
function wetA() {};
function wetB() {};
wetB.prototype = new wetA();
var wet_b = new wetB();
// Reflect.get(wetB, "prototype") === Reflect.getPrototypeOf(wet_b);
// boilerplate, not really that important
function valueType(value) {
if (value === null)
$ RUST_BACKTRACE=1 ./x.py dist --stage 0
Updating submodules
Synchronizing submodule url for 'src/compiler-rt'
Synchronizing submodule url for 'src/doc/book'
Synchronizing submodule url for 'src/doc/nomicon'
Synchronizing submodule url for 'src/doc/reference'
Synchronizing submodule url for 'src/jemalloc'
Synchronizing submodule url for 'src/liblibc'
Synchronizing submodule url for 'src/llvm'
Synchronizing submodule url for 'src/rt/hoedown'
# I claim attributes are a run-time feature
defmodule Petunia do
Module.register_attribute(__MODULE__, :myattr, accumulate: false)
Module.put_attribute(__MODULE__, :myattr, 1)
IO.puts(@myattr)
Module.put_attribute(__MODULE__, :myattr, 2)
IO.puts(@myattr)
end
# Some more privileged methods, with some private data.
class Availability:
def __init__(self):
self._is_open = False
def open(self):
self._is_open = True
def close(self):
self._is_open = False

Maybe we can add a short subsection, under the "Crates" section of crates.md, that simply tells you what you're facing if you decide to integrate Rust into a large C++ project. It would look like this:

Integrating Rust code into an existing C++ project

  • calling from C++ to Rust (the easy direction)
    • building a Rust shared object or static library is easy
    • unwinding from Rust into C++ is undefined behavior (use catch_unwind)
    • you need to either generate a C++ header from Rust (use Cheddar) or generate Rust bindings from C++ (use bindgen). Either way, these projects are young. The experience is rough, at least for the next year or two.
    • how to compile & link C++ code against your Rust library (largely a matter of knowing where the headers and libs are)
  • you should unit-test your bindings which means compiling and linking C++ unit tests with your Rust library
#include <iostream>
using namespace std;
int main() {
const int P[8] = {0, 0, 0, 0, 1, 1, 1, 1};
const int Q[8] = {0, 0, 1, 1, 0, 0, 1, 1};
int first_array[8];
char first = 'P';
@jorendorff
jorendorff / 7.md
Last active February 20, 2017 13:54 — forked from anonymous/7.md

CIS claims 72 terrorists have come to the US from the 7 countries in Trump's travel ban. Here's what I learned.

  • These cases aren't about actual attacks in the U.S. The Ninth Circuit said "The Government has pointed to no evidence that any alien from any of the countries named in the Order has perpetrated a terrorist attack in the United States." The reason I got into this mess is people claiming the court lied. They did not lie. Nor is CIS lying. This list is mainly people who aided terrorist groups, and a few FBI sting operations. In all 11 cases I got to, no attack occurred.

  • These people were not all admitted to the U.S. under current vetting procedures. See the last case listed below.

Cases

I had an hour to spend. I looked into these cases, mostly relying on news accounts.