Comment

Comment by catnaroek

> For example, you can specify a particular allocator for individual types rather than relying on each allocation to use the custom allocator.

Having a 1-to-1 correspondence between types and allocators screams of lack of separation of concerns. In any case...

> If you're outside the realm of the Rust borrow checker and want to use an arena to keep the memory side of things simple and safe, it's much easier to do properly in Ada.

Arenas can be given safe interfaces in Rust just fine: https://crates.io/search?q=arena

> memory safety facilities

The article literally says: “Tasks are awesome, but sometimes they're not quite what you want --- particularly as there's no protection against two tasks modifying the same variable at the same time.”

So much for memory safety.

> bounds checking

Implementable as a library feature. For example, in Standard ML:

    signature BOUNDS =
    sig
      val minBound : int
      val maxBound : int
    end
    
    (* INTEGER and Overflow are in the Basis Library *)
    
    functor BoundsChecked (include BOUNDS) :> INTEGER =
    struct
      type int = int
      fun toInt x = x
      fun fromInt x =
        if x < minBound orelse x > maxBound
        then raise Overflow else x
      val op+ = fromInt o op+
      val op- = fromInt o op-
      val op* = fromInt o op*
      (* rest of implementation... *)
    end
There is no need to bloat the core language.

> non-nullable pointer types

In an unusable way.

> generics

Parametric polymorphism buys you non-repetition, not safety.

> contracts

Contracts don't buy you safety. Your code will just crash at more predictable places when a contract assertion fails. But it will still crash. Hard.

Static analysis buys you safety.

parent catnaroek 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton