Arbitrary is such an arbitrary word :)

I'm not sure how to answer it in general. "Represent" in what sense? A
pointer is just a number. Since we permit a modest amount of fiddling
around with raw pointers from C-land as numbers, I imagine you have
something more explicit in mind.

Not really. Anything you can draw in a white board can be coded in C++, sometimes in a not very elegant way. An example that comes to mind (from llvm) is using placement new to put a string (char*, not std::string) after a regular struct. With most other languages you would need an extra pointer and a separate allocation.

Another example would be a mapping from string to an arbitrary value. One datastructure that is used for that in LLVM uses a single buffer it owns the strings. It is a lot faster than a non specialised hash table with pointers to externally allocated strings.

I am not sure if a lot is gained by requiring users to go to C to get this. I agree it is easier to design, but I wonder if some form of unsafe blocks could be provided. The total safety of the program is not decreased by requiring a combination of a safe and an unsafe language :-)

...

-Graydon

Cheers,
Rafael
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to