POV-Ray : Newsgroups : povray.off-topic : Why is Haskell interesting? : Re: Why is Haskell interesting? Server Time
4 Sep 2024 09:15:27 EDT (-0400)
  Re: Why is Haskell interesting?  
From: Warp
Date: 26 Feb 2010 09:25:47
Message: <4b87d9ea@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> Of course, the main one is that it's a 100% functional language

  I thought that a 100% functional language has no mutable data structures
nor functions with side-effects.

> C++ has templates, and people often compare this to generics. I'm not 
> sure why. As far as I can tell, templates not even remotely similar to 
> generics.

  Yeah, templates are a lot more powerful and versatile.

> - Templates are, as best as I can tell, preprocessor macros on steriods. 
> They automate the process of creating a new, seperate, class for each 
> combination of parameter values. It's like copy & pasting each time you 
> want a new container class, except the template preprocessor automates 
> it for you. This is clearly very much more maintainable, but not the 
> same as extending the type checker.

  Templates are not used only to generate classes, but also functions and
basic types. Template parameters can also be of almost any type (classes,
basic types, other templates, etc.) Also, templates can be recursive, which
is rather huge.

  In short, templates allow compile-time polymorphism (as opposed to runtime
polymorphism in most OO and functional languages).

-- 
                                                          - Warp


Post a reply to this message

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