4,235 karma · joined Sep 10, 2015 (11y ago) · 1,525 submissions
comment 8y ago · link · parent
The IPC cost should not be significant compared to the rest of the web server code.
Can also ask them to do the work and provide a small open source in-process shim that sets up and talks to the sandboxed process.
comment 8y ago · link · parent
I think it hasn't been done because interior mutability is relatively rarely used, and being able to assert immutability in generic code is not actually that useful (and for things like hash map keys you'd need to implement Hash or other traits manually anyway, so you'll probably notice the issue).
In non-generic code, you have to call functions like "borrow()", etc. to access the internally mutable data, so you know it's mutable.
Regarding "fearless concurrency", the Sync trait ensures that, allowing "interior mutability" only if thread-safe (i.e. Mutex or Atomic).
Obviously you can have race conditions between modifications of different Mutex/Atomics, but that's an unavoidable fundamental problem: even transactional systems will have race conditions if you use two separate transactions where you should have used one, and single-threaded event based systems also have them if you "defer" part of the computation improperly.
comment 8y ago · link · parent
As for implicit parallelization with no annotations at all, the main Haskell implementations don't seem to do it, so I guess it just doesn't work (the reasons probably being that there are penalties due to caches being CPU local and the cost of synchronizing threads that make automatic micro-parallelization much worse that explicit coarse-grained parallelization, unless the micro-parallelization is done in hardware by the CPU out-of-order logic).
And obviously a type system with controlled mutability like Rust's allows to express explicit parallelization just fine (in fact, writing a safe explicitly parallelized web browser in Servo was one of the main goals of it).
> What you really want is a static checker that only prevents shared, simultaneous mutability but admits everything else. The Rust borrow checker is an important step in that direction but it's not it.
Is there any example of a static checker that allows more expressive programs than Rust's while preserving the same guarantees? (and without requiring extra annotations like programmer-supplied proofs or using best-effort automatic theorem proving). Is that even possible?
comment 8y ago · link · parent
If you have an &mut or owned mut variable, then you know that you can only mutate it through that name.
If you have a non-mut owned variable, then you know that only the Cell/RefCell/Atomic/Mutex parts can be mutated, and only through that name.
If a Rust program doesn't contain the words "mut", "unsafe", "Cell", "RefCell", "Mutex" or "Atomic[...]", then everything in it is immutable.
That gives the same guarantees as Haskell's immutability where desired, but it allows to actually make use of CPU capabilities like writing to memory, and express basic operations like assigning a value to a position in an array.
Or in other words, what you really want is a system that lets you mutate something as long as you are the only one with a reference to it, and then make it immutable and give it around, while also allowing you to "get it back" exclusively either with static checks (via lifetimes) or dynamic reference count checks.
Haskell's pure immutability system, while safe unlike Java's, is just a very restricted version of such a system, that is not powerful enough to write safe programs that are as efficient as C programs (since you can't modify memory), or express imperative code even when they are safe.
comment 8y ago · link · parent
The next problem is that complete immutability is also wrong, because controlled mutable aliasing with linear types (like the system available in Rust) is what you really want since it's more general, efficient and expressive (allows mutable data structures), and complete immutability is just a special case of controlled mutable aliasing.
The third problem of Haskell is the weird syntax, that doesn't follow the common C/Java/JS or Python syntaxes for no good reason, making it hard to read and learn the language.
And if one were to change these things in Haskell, the result would essentially be Rust (or more precisely, a future version of Rust once all the missing abstractions like HKT, specialization, etc. are added), so I think that's what one should use instead.
comment 8y ago · link · parent
After almost 10 years, the old version is still in use, and the new version isn't even that much better.
comment 9y ago · link · parent
> a functional language
Has closures.
Has pattern matching.
Has algebraic data types (however variants can't have generic parameters not present on the data type itself, but you can use trait objects to do that).
Functions that don't take &mut parameters, & parameters with types with interior mutability and don't call functions that do I/O are pure (although they may not terminate and may abort).
> optional lazy constructs
"Automatic" lazy costructs are usually unnecessary and thus almost never used, but can be implemented as a library using macros.
Can also just use closures and call them explicitly.
> great polymorphism
Has trait/typeclass polymorphism with either monomorphization or dynamic dispatch.
Structures can't be inherited, but composition gives equivalent results and is the proper way to do it.
There have been several proposals for inheriting structures though, so maybe it will be available at some point, despite not being advisable.
> statically typed with inference
Yep.
> generics
Yup.
Not higher kinded, no constant integer parameters and not variadic yet, but those features should be available in the future.
> great concurrency story
Rust is the only popular language supporting safe concurrency without giving up the ability to share memory between threads.
> an efficient GC
It turns out that a GC is unnecessary, and that reference counting is enough, which is what Rust provides (although it's still relatively rarely used).
If you insist on a tracing GC, there are/have been several attempts to add it, and maybe there will be a mature one in the future.
In particular, there is a "rust-gc" crate, and Servo has a working integration with the SpiderMonkey GC, which I suppose should be possible for others to use with some work.
> compiles quickly
Work in progress (incremental compilation, more parallelization).
> self contained binaries
Yes (or optionally using shared libraries).
> simple and effective tooling which takes only seconds to setup
rustup can install the compiler and package manager in one line.
If you want an IDE, you'll have to install that too separately. Work in progress on improving IDE functionality and ease of use.
> giving you perfomance that equals java and can rival C
Performance is at least theoretically the same as C since the generated assembly code is conceptually the same (other than array bounds checking, which can be opted out from with unsafe code).
> low memory footprint
Same as C.
comment 10y ago · link · parent
It would dramatically increase the quality of their store and brand, and it benefits from economies of scale.
Assuming they pay $100 for an high quality review, then a $10 item would increase by only 1 cent if at least 10000 are sold, which seem reasonable conditions.
For categories with many very similar items, reviews should be cheaper since a standard review procedure could be designed and applied quickly, offsetting the lower sales per items.
comment 10y ago · link · parent
You can do what you describe as long as you use Rust's reference counting support (Rc and Arc), which includes weak references that can be used for parent pointers, plus RefCell and Mutex for mutation.
To have an object "self-destruct", have it remove all reference counted pointers to itself.
You can pass an &Rc<Self> (or &Rc<RefCell<Self>> or &Arc<Mutex<Self>>) as the self parameter if you want to let an object create references to itself. If you want an object to be able to drop itself immediately in that case, use an Rc<Self> instead of an &Rc<Self>, and call drop(self) in the method (this also work if you are not using reference counting and just pass Self, of course).
You should try to not do this kind of thing though, because it adds overhead and the compiler cannot statically check that you are not leaking reference counted cycles or deadlocking on mutexes or refcells (which is not a Rust limitation, it's just impossible without having the programmer write a machine-checkable proof).
If you do it in C++ the compiler also cannot check whether you are referencing freed memory or incorrectly concurrently modifying the same object.
comment 10y ago · link · parent
Relying on a weak password and a "trusted computing" mechanism like this one from Qualcomm to prevent an attacker with physical access from brute forcing it is not really advisable.
Using such a mechanism at all has downsides since it means that you lose the data if the mechanism or the entire device stops working, while otherwise you could simply move the SSD/flash/storage unit to a new identical device and have it just work as long as you type the correct password.
comment 10y ago · link · parent
It would be greatly appreciated if the code used for the paper were released, even better if it's in the form of a Firefox extension and submitted to the Tor Browser maintainers for inclusion in the default install.
comment 10y ago · link · parent
If the employee loses the stock when he's fired early, then the company has a huge incentive in firing him a day before he vests, and thus he should regard the vesting compensation as nonexistent.
If the employee retains the stock when he's fired early, then he can just get himself fired to ignore the vesting period, making the vesting pointless.
It seems that vesting can only work if the employee is so essential that the company would never fire him because the company would then be highly likely to fail, which should only apply for founders in a functional company.
comment 10y ago · link · parent
Sending should always succeed immediately and if anything needs to be automatically triggered in response, the trigger should be executed asynchronously.
A great way to immediately see the problem is, for anyone with Rust experience, to think of this as a function taking an &mut self being somehow reentered without that &mut self being passed out by the function itself.
comment 10y ago · link · parent
In particular Rust has similar syntax, seems to have all Reason's features plus the linear types and regions/borrowing that allow memory and concurrency safety while still being able to mutate memory and not being forced to use GC.
They are aware of Rust since they cite it in their page, so I wonder why they decided to create this instead of using Rust.
It would be nice if they explained this in the FAQ.
I guess it might be useful if you have an OCaml codebase to interface with but don't already know OCaml, but given the relative obscurity of OCaml that seems a pretty narrow use (and also Facebook isn't known to make extensive use of it, afaik).
comment 10y ago · link · parent
Surely an UI with controls specific to the task at hand is much better than having the user guess what the bot responds to and what it can do?
In the restaurant use case, for instance, a QR code + text URL that points to a website where you can advertise the restaurant with whatever graphics and UI you want seems far better than some sort of text interface (which also requires them to be Kik users, know they can scan the code, etc.).
comment 10y ago · link · parent
Once that is satisfied, commits should be as small as possible, so that information about the grouping of changes is preserved.
comment 10y ago · link · parent
What they should do instead is this:
1. If the server is not overloaded, do not captcha any traffic at all
2. If the server starts being overloaded, only captcha traffic from IPs that have been detected as attacking THAT specific site
3. If the server is still overwhelmed, only then switch to captchaing all IPs with "bad reputation"
Most websites are probably almost never under attack, so this would make encountering CloudFlare captcha extremely rare in the wild while still providing DDOS protection.
They could even only do this for Tor exit nodes and other IPs that are known to be used by lots of people.
If a site is being DDOSsed a lot and the slower start up of this technique is a problem, then they can revert for those sites to the current behavior of using reputation.
comment 10y ago · link · parent
Encrypting the data before hashing with a secret key solves this issue if applicable.
> You can't know that because you can't see into the future.
The "best cipher" is the single one you would have used if you had not decided to use a cipher cascade.
The idea is to make sure that your cascade is never worse than that single cipher.
comment 10y ago · link · parent
If you are using 10 ciphers or 10 hash functions or 10 signature schemes, then you need 10 different breakthroughs before it all falls down.
There is really no reason to not do this unless performance is important, and a lot of times performance does not really matter.
NOTE: obviously you need to this properly and use a different key for each cipher, concatenate hashes, concatenate signatures and so on. Also, you should start encrypting with the best implemented ciphers, so that plaintext is not leaked if the worst ciphers happen to have timing/cache vulnerabilities.
comment 10y ago · link · parent
While such a structure means that a game developer can earn 10k or more from a single player, it also makes the game worse for those who aren't willing to spend unlimited amounts of money and thus drives some of them away or causes them to decide to not spend any money at all.
If this is not desired, the simple solution is to have an "unlimited pass" that gets you access to all current and future IAP/DLC content that gives a game advantage for either a fixed one-time fee or a fixed subscription fee.
This is probably not often done because the game developers believe that it would be less profitable overall.
comment 10y ago · link · parent
Which of these are supported:
1. Full PostgreSQL SQL language
2. All isolation levels including Serializable (in the sense that they actually provide the same guarantees as normal PostgreSQL)
3. Never losing any committed data on sub-majority failures (i.e. synchronous replication)
4. Ability to automatically distribute the data (i.e. sharding)
5. Ability to replicate the data instead or in addition to sharding
6. Transactionally-correct read scalability
7. Transactionally-correct write scalability where possible (i.e. multi-master replication)
8. Automatic configuration only requiring to specify some sort of "cluster identifier" the node belongs to
comment 10y ago · link · parent
Paying per article seems to have the big issue that you actually have to think whether you to want to pay or not and might feel cheated if the article is not as good (they offer refunds, but there must be a limit or catch or everyone would just refund everything).
comment 10y ago · link · parent
It feels like most examples of commercial AI usage are features (image search, automatic face tagging, etc.) that get added to existing products by large companies with access to large datasets and computing power.