[ruby-talk:00196] Re: defining self causes a segmentation fault
From:
matz@... (Yukihiro Matsumoto)
Date:
1999-01-18 03:12:05 UTC
List:
ruby-talk #196
Hi.
In message "[ruby-talk:00191] defining self causes a segmentation fault"
on 99/01/16, Julian Fondren <julian@imaji.net> writes:
|Hello,
|
|In ruby you can't change the value of self, and I just learned this,
|because of the following:
Yes. The `self' is pseudo variable, which looks like local variable,
but it really is a constant.
|-:1: Can't change the value of self
|self=nil
| ^
|-:1: [BUG] Segmentation fault
|
|
|which partially explains things. I assume here that this is some kind of
|bug and that ruby isn't supposed to segfault on an attempt to define
|self.. though maybe it is. Also this might be restricted to my machine -
|something I have certainly seen before - or at least the segfault part
|might. Anyway, what's the deal here?
Any SEGV caused by script is supposed to be bug in interpreter or
extension library. It's a bug. Here's the patch.
--- parse.y 1998/11/26 08:25:45 1.1.1.2.2.54
+++ parse.y 1999/01/18 02:59:05
@@ -574,4 +574,6 @@
$$ = $<node>3;
+ if ($$) {
$$->nd_value = $4;
fixpos($$, $4);
+ }
}