POV-Ray : Newsgroups : povray.off-topic : Mildly interesting article Server Time
5 Nov 2024 01:26:16 EST (-0500)
  Mildly interesting article (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Orchid XP v7
Subject: Mildly interesting article
Date: 11 Nov 2007 06:46:20
Message: <4736eb8c$1@news.povray.org>
http://www.cs.princeton.edu/~dpw/popl/06/Tim-POPL.ppt

(Yes, you need something that understands M$'s hated PowerPoint file 
format...)


Post a reply to this message

From: nemesis
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 12:35:00
Message: <web.47373d1ead72000247c4e9b20@news.povray.org>
Orchid XP v7 <voi### [at] devnull> wrote:
> http://www.cs.princeton.edu/~dpw/popl/06/Tim-POPL.ppt
>
> (Yes, you need something that understands M$'s hated PowerPoint file
> format...)

yes, when a guy like Tim speaks, developers of toolsets should hear.  It's a
good thing that a well-known developer of high profile titles is aware of
functional programming and Haskell and demanding C++-alike tool developers to
provide similar features, like guards and comprehensions...

much of the problems he lists as plagues in the Unreal code have to do exactly
with null pointer deferencing and out-of-bounds arrays, situations which have
no parallel in Haskell...


Post a reply to this message

From: Orchid XP v7
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 13:04:45
Message: <4737443d$1@news.povray.org>
nemesis wrote:

> yes, when a guy like Tim speaks, developers of toolsets should hear.  It's a
> good thing that a well-known developer of high profile titles is aware of
> functional programming and Haskell and demanding C++-alike tool developers to
> provide similar features, like guards and comprehensions...
> 
> much of the problems he lists as plagues in the Unreal code have to do exactly
> with null pointer deferencing and out-of-bounds arrays, situations which have
> no parallel in Haskell...

I just find it interesting to see Haskell (which everybody thinks of as 
"slow") and games programming (which everybody thinks of as 
"speed-critical") in the same document... ;-)

In fairness, Haskell has not (yet) evolved to the point where array 
index exceptions can be avoided. (Not by compile-time checking anyway.) 
Admittedly, it's a little less serious than the C case (i.e., your 
program instantly stops with an eror message rather than randomly 
corrupting memory), but that's still not ideal.

Arguably partial functions are the Haskell equivilent of null pointer 
issues - as exemplified by "head []". If your code produces this 
exception, good luck working out what the problem is. ;-)

I've said it before and I'll say it again - people would probably take 
Haskell a lot more seriously if there were big applications written with 
it. (The Haskell compiler almost certainly doesn't count.)


Post a reply to this message

From: nemesis
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 15:35:01
Message: <web.47376739ad72000247c4e9b20@news.povray.org>
Orchid XP v7 <voi### [at] devnull> wrote:
> Arguably partial functions are the Haskell equivilent of null pointer
> issues - as exemplified by "head []". If your code produces this
> exception, good luck working out what the problem is. ;-)

hmm, ok.  problem is, there are informations only available at runtime, not
compile time.  Perhaps what Tim is asking is for automatic generation of
runtime tests for these common situations.


Post a reply to this message

From: Orchid XP v7
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 17:02:50
Message: <47377c0a$1@news.povray.org>
nemesis wrote:
> Orchid XP v7 <voi### [at] devnull> wrote:
>> Arguably partial functions are the Haskell equivilent of null pointer
>> issues - as exemplified by "head []". If your code produces this
>> exception, good luck working out what the problem is. ;-)
> 
> hmm, ok.  problem is, there are informations only available at runtime, not
> compile time.  Perhaps what Tim is asking is for automatic generation of
> runtime tests for these common situations.

There are various manual and automated test systems for Haskell. It's 
not something I've looked at. It's also possible to do crazy things 
using experimental language extensions to (clumsily) encode the length 
of a list into its type, thus allowing it to be checked at compile-time, 
but this becomes messy rapidly [since the language isn't supposed to 
support it]. Apparently there are programming languages that have this 
as a design goal... and they're even rarer than Haskell. (If you can 
imagine that...)


Post a reply to this message

From: Warp
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 18:00:33
Message: <47378990@news.povray.org>
nemesis <nam### [at] gmailcom> wrote:
> much of the problems he lists as plagues in the Unreal code have to do exactly
> with null pointer deferencing and out-of-bounds arrays, situations which have
> no parallel in Haskell...

  In C++ it's possible to create more abstract arrays and pointers which
are equally easy (if not even easier) to use than the native equivalents
and can be compiled to be equally fast.

  The advantage of this abstraction is that things like bound checks and
null pointer checks can be added to them.

  If the company has developed a robust library of abstract libraries and
then imposes strict rules on the coders (like "never do a 'int table[100];'
but always do a 'OurArray<100> table;'") then most of the problems can be
quickly caught in testing.

  The great thing is that during debugging and testing a version of the
library with full checks can be used, and when the final product has been
tested to death, then a version of it without the checks (for efficiency)
can be very easily compiled for distribution.

  So you get the best of both worlds: Null pointer, array boundary and
other types of checks at debugging and testing, full speed at release.

  The main obstable in achieving this are stubborn programmers who resist
change and who suffer from the C-hacker-syndrome.

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 18:37:41
Message: <47379245$1@news.povray.org>
nemesis wrote:
> functional programming and Haskell and demanding C++-alike tool developers to
> provide similar features, like guards and comprehensions...


http://www.rubinsteyn.com/template_insanity.html

-- 
   Darren New / San Diego, CA, USA (PST)
     Remember the good old days, when we
     used to complain about cryptography
     being export-restricted?


Post a reply to this message

From: Darren New
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 18:40:30
Message: <473792ee$1@news.povray.org>
Warp wrote:
>   So you get the best of both worlds: Null pointer, array boundary and
> other types of checks at debugging and testing, full speed at release.

You do realize that this isn't in any way unique to C++, yes? :-)  I 
mean, without even writing two versions of the library?

-- 
   Darren New / San Diego, CA, USA (PST)
     Remember the good old days, when we
     used to complain about cryptography
     being export-restricted?


Post a reply to this message

From: Warp
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 18:47:13
Message: <47379480@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> http://www.rubinsteyn.com/template_insanity.html

  Template metaprogramming is really mean to compilers. This is because
template metaprogramming is in practice functional programming where loops
are made exclusively by recursion. Recursions need stacks or other forms
of keeping track of where we are, and thus the memory usage is proportional
to the number of recursions. (In many functional languages tail recursion
can be optimized internally into a non-recursive loop, but you can guess
if C++ compilers support the notion of "tail recursion" with templates...)

  In template metaprogramming a recursive loop means in practice that the
name of the templated type is very long (each "loop" makes the name longer).

  Most compilers have a fixed amount of memory allocated for demangling
template types. Thus they support only a very small amount of recursions.
In some compilers you can increase this limit with a command-line parameter
(eg. gcc supports this), but it's still fixed.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Mildly interesting article
Date: 11 Nov 2007 18:51:07
Message: <4737956b@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> You do realize that this isn't in any way unique to C++, yes? :-)  I 
> mean, without even writing two versions of the library?

  Yet C++ is used to make games and those other languages aren't. Why?

  (Perhaps one advantage of C++ is that there are millions of libraries
out there written in C, and they can usually be used in C++ as they are,
without any modifications. Few other languages can do that.)

-- 
                                                          - Warp


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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