[bitc-dev] Call by need?

Pal Engstad pal_engstad at naughtydog.com
Fri Sep 10 12:55:19 PDT 2010


On 9/10/2010 12:32 PM, wren ng thornton wrote:
> [1] My numbers are borne out by some notorious competitions which are 
> often cited both for and against Haskell, despite how benchmarking 
> competitions pervert code far away from normal patterns:
> http://shootout.alioth.debian.org/u32/which-programming-languages-are-fastest.php
> http://shootout.alioth.debian.org/u32q/which-programming-languages-are-fastest.php
> http://shootout.alioth.debian.org/u64/which-programming-languages-are-fastest.php
> http://shootout.alioth.debian.org/u64q/which-programming-languages-are-fastest.php

I very much doubt you would write Haskell code like that... Ptr Word8? Is it even safe?

No, let's not even go there. Haskell is nice, but slow and for the niche of academics that don't understand real constraints and performance. Lazyness by default would make me turn away from using BitC, and I am sure a lot of other industrial users would too. I would *not* be opposed to lazyness annotations though, e.g. by a single-letter prefix, like e.g. in types @, and @{} for making a lazy expression and #{} for forcing it. For instance, let's say that pattern matching was a primitive operation, and we wanted to define if:

def if[A](x:Bool, then:@A, else:@A) =
   match x with 
      | True -> #{then}
      | False -> #{else}

def test() =
   if(a == 0, @{printf("true")}, @{printf("false")})

With mixfix, this can easily be made into syntax:

mixfix if_then_else_ = (t,a,b) => if(t, @{a}, @{b})

def test2() =
   if a == 0 then printf("true") else printf("false")

Thanks,

PKE

-- 
Pål-Kristian Engstad (pal_engstad at naughtydog.com), 
Lead Graphics & Engine Programmer,
Naughty Dog, Inc., 2425 Olympic Blvd, 3000 West,
Santa Monica, CA 90404, USA. Ph.: (310) 633-9112.

"Emacs would be a far better OS if it was shipped with 
 a halfway-decent text editor." -- Slashdot, Dec 13. 2005.


More information about the bitc-dev mailing list