POV-Ray : Newsgroups : povray.off-topic : Unit Testing question Server Time
30 Jul 2024 00:17:53 EDT (-0400)
  Unit Testing question (Message 21 to 22 of 22)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Darren New
Subject: Re: Unit Testing question
Date: 10 Jun 2011 16:11:11
Message: <4df27a5f$1@news.povray.org>
On 6/10/2011 11:26, Orchid XP v8 wrote:
> Yeah, well, Smalltalk is no functional language. ;-)

Oh, sorry, I thought we were still talking about Haskell.

Yeah, the thing is when you compile the expression #[1, 2, 3] it creates a 
list and points the executable code to that, or some such.

The same thing happens with Python default arguments.

> When you define a class named Foo, it defines a global variable named Foo
> which contains a Class object describing the class.

Yes. But "global variable" is a bit of a misnomer in a language where global 
variables are simply names in a hashtable that the compiler looks up at runtime.

> The fun thing is, since True and False are classes, they are also global
> variables, and you can do something like True := 42, which utterly confuses
> everything.

I think true, false, and nil are usually special-cased in the compiler 
(along with ifTrue:ifFalse:, etc) for performance reasons. But yes, in 
theory, you could do that.

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

From: Orchid XP v8
Subject: Re: Unit Testing question
Date: 10 Jun 2011 17:03:15
Message: <4df28693$1@news.povray.org>
On 10/06/2011 09:11 PM, Darren New wrote:
> On 6/10/2011 11:26, Orchid XP v8 wrote:
>> Yeah, well, Smalltalk is no functional language. ;-)
>
> Oh, sorry, I thought we were still talking about Haskell.

Uh, yeah. You can't do anything crazy like that in Haskell.

Worst thing you can do is unsafePerformIO. Also known as "tell the 
compiler that its assumptions hold for this expression, because I say 
so". Naturally, if you are mistaken... bad things happen.

> Yeah, the thing is when you compile the expression #[1, 2, 3] it creates
> a list and points the executable code to that, or some such.

That's the one.

>> When you define a class named Foo, it defines a global variable named Foo
>> which contains a Class object describing the class.
>
> Yes. But "global variable" is a bit of a misnomer in a language where
> global variables are simply names in a hashtable that the compiler looks
> up at runtime.

Not just the compiler. The entire runtime system. And since the IDE *is* 
the runtime system...

> I think true, false, and nil are usually special-cased in the compiler
> (along with ifTrue:ifFalse:, etc) for performance reasons. But yes, in
> theory, you could do that.

It probably varies by implementation. I suppose I could dig out my copy 
of VisualWorks if I /really/ cared...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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