POV-Ray : Newsgroups : povray.off-topic : How does Haskell work? : Re: How does Haskell work? Server Time
4 Sep 2024 09:15:58 EDT (-0400)
  Re: How does Haskell work?  
From: Warp
Date: 17 Mar 2010 11:19:29
Message: <4ba0f301@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> And in Smalltalk, conditional branches are also method calls. You send two 
> "blocks" to a boolean, and it executes the appropriate one.  E.g., you call

> (x == 5) ifTrue: [y print] ifFalse: [z print]

> So (x == 5) sends the == message to x with the argument 5, and that returns 
> either true or false.  The methos "ifTrue:ifFalse:" in "true" evaluates and 
> returns the first argument. The method of the name in "false" evaluates and 
> returns the second argument.  So, technically, you don't need conditionals 
> either, just deferred evaluation (aka lambda expressions).

  Could a simple conditional be more awkward than that?

  (I can only imagine how hard it is for compilers to optimize that into a
regular machine code conditional construct.)

-- 
                                                          - Warp


Post a reply to this message

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