|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
|
|