Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Herb Sutter on Heterosexual Computing

Name: Anonymous 2011-06-17 7:51

Looks like Microsoft is tired of HomogenousHomosexual Computing (ie. Apple/Macs) and paints a possible future of mainstream HeterogenousHeterosexual Computing.
 
http://media.ch9.ms/ch9/7655/e3d5a308-d1fb-4693-998e-9f04000f7655/AMDFusionHerbSutterKeynoteAMP_high_ch9.mp4

It's a bit Microsoft biased, made me cringe a bit in a few spots, but the bulk of the talk is rather interesting. Herb Sutter used to be the chairperson of the ISO/IEC C and C++ language committees, by the way. I wonder how the Linux kernel will adapt to heterogeneous computing? We already have OpenCL, but the kernel isn't using it itself--is there any application for this kind of stuff inside of a kernel?

Name: Anonymous 2011-06-17 9:38

>>5
You can't decide whether a procedure is pure or impure:
pure int function(int a) {
   if (0) puts("Impure");
   return a*2;
}

is pure, and a sufficiently smart compiler may detect it.
pure int function(int a) {
   if (runtime_condition_that_always_holds_false) puts("Impure");
   return a*2;
}

is also pure, because you know that that condition will always be false, but the compiler doesn't, so it will be rejected.
This example is stupid and means nothing.

Now, we don't want pure functions just to fap on their purity, pure functions have a nice property: referential transparency. But, we can achieve referential transparency using side effects:
(define (map f xs)
 (let loop ((xs xs) (r '())
   (if (null? xs) (reverse! r) ;; destructively updates r, it's a side effect.
       (loop (cdr xs) (cons (f (car xs)) r)))))

is a perfectly fine definition of the procedure map, because:
(let ((old-x (deep-copy x)))
 (and (equal? (map f x) (map f x))
      (equal? old-x x)))

will always be true (if f is also pure).

Yet, reverse! is not pure, so the compiler will reject a perfectly fine ``pure'' function.

Manual memory management is just stupid in functional languages, but it's not related to function's purity (except when the new pointer escapes from the function).

That said, IHBT again.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List