News for hackers. Stuff that matters.
Re:The Idea of Lisp by vertex-four on Friday December 16, 2016 @11:16AM (#13194236)
void in C can't be created, used, or passed around - () can.
Re:The Idea of Lisp by shakna on Friday December 16, 2016 @01:26PM (#13195450)
But void pointers can, and are often used.
Re:The Idea of Lisp by vertex-four on Friday December 16, 2016 @02:29PM (#13196003)
So in Rust, the equivalent of void* with references instead looks like:

    enum Void{}
    fn foo(v: &Void){ ... }
    let bar : Void;
    fn abc() -> &Void{ ...}
    fn xyz() -> Void{ ... }
You can't create a Void, and you can't cast to it either - it's not a bottom type. So you can't put anything in bar. And as a result, you can't create a reference to a Void, so you can't call foo. And abc and xyz just can't be implemented in the first place.

On the other hand, you can do all of these just fine:

    fn foo(v: ()){ ... }
    fn bar(v: &()){ ... }
    ...
    let v = ();
    bar(&v);
    foo(v);
The fact that you can create and use an empty tuple as a value shows that it is not equivalent to Void.

(All statements here are made within the safe subset of the language - unsafe allows access to intrinsics that would allow a Void to be made, and a reference to Void.)

Re:The Idea of Lisp by kbp on Friday December 16, 2016 @03:59PM (#13196761)
void * isn't related to void (or this discussion), they just reused the keyword.