POV-Ray : Newsgroups : povray.off-topic : Haskell vs Java: Building a ray tracer : Re: Haskell vs Java: Building a ray tracer Server Time
29 Jul 2024 02:21:00 EDT (-0400)
  Re: Haskell vs Java: Building a ray tracer  
From: nemesis
Date: 28 Jun 2012 18:30:00
Message: <web.4fecda86321519bc773c9a3e0@news.povray.org>
Invisible <voi### [at] devnull> wrote:
[tldr]

> and this is valid. Notice, however, that it is impossible to write an
> "unwrap" function. Because once you "wrap" something, its original type
> information is lost forever, so there's no way in hell to know what type
> to cast it back to.

what about in heaven?  In Lisp there's no such hellish troubles. :)

> Now a "shape" is simply an ordinary data structure, which contains some
> function pointers. And each sort of shape - a sphere, a cone, whatever -
> is an ordinary /function/ which fills out this data structure with the
> right function pointers. In particular, every type of shape now has the
> same type signature. There is no Sphere type, no Plane type, no Cone
> type, there is only a Shape type. So now we can write
>
>    [sphere 0 1, plane 1 0]
>
> and have it be well-typed. (It's [Shape].)

So your solution to get away from the complaints of the compiler is to have all
types be the same single type?  Yes, sounds like the Lisp solution too. ;)

> The short summary is that Haskell, the finest
> functional programming language in the land, is superior to Java, one of
> the more sucky OOP languages. Not exactly a revelation, is it? I think
> I'm going to go outside for a while...

you do good. :)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.