News for hackers. Stuff that matters.
Re:Hack: a new programming language for HHVM by United857 on Thursday March 20, 2014 @03:02PM (#7437832)
(Disclaimer: FB employee.)

Do you also argue that C++ is built on top of a crumbling foundation, because it's based on C, a ancient language with almost no type-safety?

Re:Hack: a new programming language for HHVM by bluetech on Thursday March 20, 2014 @03:11PM (#7437876)
Why do you say C has no type safety? Only way around the type system is void, explicit casts and I guess unions.

It admittedly doesn't have a very advanced type system, that's true.

Re:Hack: a new programming language for HHVM by munificent on Thursday March 20, 2014 @03:25PM (#7437959)
> Only way around the type system is void, explicit casts and I guess unions.

And typedefs. Given that there's no parametric types, you run into void* quite frequently as well, so saying "only" inaccurately minimizes the scale of how much C code isn't strictly type safe.

Re:Hack: a new programming language for HHVM by bluetech on Thursday March 20, 2014 @03:34PM (#7438007)
Right, void* is used quite a lot for "generic" data structures. But I'm not sure that's what he meant. The reason I said "only" was that from my own experience, most C data structures are tailored for a specific use and so I don't see void* too much in this context.

And may I ask why you say "typedef" is unsafe? It is merely a type alias, like e.g. Haskell's and ML's "type", or isn't it?

Re:Hack: a new programming language for HHVM by munificent on Thursday March 20, 2014 @04:30PM (#7438484)
> It is merely a type alias, like e.g. Haskell's and ML's "type", or isn't it?

It is, but it freely allows conversion between the aliased types.

    typedef int Feet;
    typedef int Meters;

    int main() {
      Feet height = 6;
      Meters inEngland = height; // <-- OK. :(
    }
Re:Hack: a new programming language for HHVM by anaphor on Thursday March 20, 2014 @04:42PM (#7438598)
I'm pretty sure you and the parent were thinking of Haskell's `newtype` not `type`

λ> :{

Prelude| type Feet = Int

Prelude| type Metres = Int

Prelude| :}

λ> let a = 5 :: Feet

λ> let b = 4 :: Metres

λ> :t a

a :: Feet

λ> :t b

b :: Metres

λ> a + b

9

λ> let f = id :: Feet -> Feet

λ> f b

4

Re:Hack: a new programming language for HHVM by azth on Thursday March 20, 2014 @03:38PM (#7438032)
C++ attempted to fix type safety issues in C.
Re:Hack: a new programming language for HHVM by reikonomusha on Thursday March 20, 2014 @06:51PM (#7439424)
You don't need to add a disclaimer about your workplace. It doesn't contribute at all to your question.

I do not think C is a "crumbling foundation". I would not suggest that C be used for large scale engineering efforts, but it's a relatively well-defined language with semantics dictated by a formal standard. A lot of research has gone into C compilers, which are state-of-the-art.

With that said, one of the biggest complaints I hear about C++ is that it still has the legacy of C embedded in it.