News for hackers. Stuff that matters.
Re:C0, an Imperative Programming Language for Novice Compute... by Shoop on Wednesday October 18, 2017 @11:29AM (#15499928)
Here is some more information about C0:

C0 is used in 15-122, Carnegie Mellon's second semester introductory programming class. I am currently taking this class. The class teaches C0 for the first two thirds of the semester and then transitions to C for the final part of the semester.

C0 has essentially the same syntax as C, but for pedagogical purposes the semantics of the language have been changed to be much more similar to java. Instead of manual memory management, there is a garbage collector, and user defined structs can only be allocated on the heap. Additionally, there is only one integer type which is a signed 32-bit two's complement integer. Overflow is defined as wrapping. strings are opaque immutable types implemented at a language level, rather than just null-terminated buffers. C0 catches out of bounds array accesses at run time. While C0 internally stores array lengths to perform this check, the length is not accessible from C0 code so array lengths must be passed around just the same as C.

C0's biggest feature beyond C is that it allows for contracts. Functions can have preconditions and postconditions. There are also loop invariant contracts and assertions. These contracts are checked at run time when specific flag is passed to the compiler or interpreter (C0 has both, and uses a bytecode internally). A major focus of the class is proving the safety and correctness of the programs we write using these contracts. We are encouraged to prove safety and correctness using only logical reasoning from contract to contract, not operational reasoning. A co-requisite of the class is a course in proofs. There seems to be a heavy influence on the teaching style from Dijkstra's "On the cruelty of really teaching computing science" [1].

The 15-122 class has written assignments focusing on the proofs part of the course and programming assignments which for the most part are automatically graded by autolab [5]. Our code is tested against a number of unit tests to ensure its correctness and our contracts are also tested to see if they can catch bugs in faulty implementations.

C0's implementation is not open source, but it appears to be used in ongoing research [2]. Here is the language website and course website [3], [4].

[1] https://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD103...

[2] http://www.cs.cmu.edu/~fp/papers/cc016.pdf

[3] http://c0.typesafety.net/

[4] http://www.cs.cmu.edu/~15122/

[5] http://www.autolabproject.com/

Re:C0, an Imperative Programming Language for Novice Compute... by acmustudent on Wednesday October 18, 2017 @11:39AM (#15500037)
A cmu freshmen on hn and over 900 days old. The one thing i don’t like about this school is that most cs majors aren’t the hn type
Re:C0, an Imperative Programming Language for Novice Compute... by akhilcacharya on Wednesday October 18, 2017 @01:56PM (#15501316)
Its fascinating that someone at CMU would have this issue.

If it's (allegedly) a problem at CMU, where isn't it a problem?

Re:C0, an Imperative Programming Language for Novice Compute... by ksikka on Wednesday October 18, 2017 @11:49AM (#15500151)
What is the HN type?
Re:C0, an Imperative Programming Language for Novice Compute... by grayhatter on Wednesday October 18, 2017 @12:15PM (#15500395)
Likes to solve interesting problems that no one has done before?

Learning about strange/engaging things, even if it's not directly useful?

Taking apart a new toy, just to see how it works?

Re:C0, an Imperative Programming Language for Novice Compute... by adrianN on Wednesday October 18, 2017 @12:24PM (#15500473)
Having too much free time on your hands and wasting it on the Internet while fooling yourself into believing that you learn something useful..
Re:C0, an Imperative Programming Language for Novice Compute... by scandox on Wednesday October 18, 2017 @11:58AM (#15500243)
People who visit and comment on HN?