On Sat, 2003-01-04 at 04:05, Dan Sugalski wrote:
> At 7:27 PM +0100 1/3/03, Erik Bågfors wrote:
> >On Sat, 2003-01-04 at 00:28, Gopal V wrote:
> >>  If memory serves me right, Dan Sugalski wrote:
> >>  > language-level "we're object-oriented dammit!" objects, not the
> >>  > lower-level stuff we're currently working with) should/will behave.
> >>
> >>  yay ! ... finally !
> >
> >The moment we've all been waiting for :)
> 
> Sheesh, everyone lay on the guilt, why don't you? :-P

Working on it....
To be honest, I won't have much time from next week so now is probably
the only time I have to do something for a long time.  So all I can do
is lay on the guilt :)

> >  > > reference-style objects and non-reference values.
> >>
> >>  How large can a non-reference value be ? ... (in the .NET opcodes the
> >>  'struct' seems to be unlimited in size ...) But well, I'd settle for
> >>  a non-reference of at least large integers (64bit)...
> >>
> >>  And how will non-reference values dispatch methods ? ... would they be
> >>  "boxed" into a reference for each method call, so that the method call
> >>  can modify them ? ...or are all non-reference values immutable ?....
> >>
> >>  to put it down clearly ...
> >>
> >>  MyValueType a;
> >>  a.Modify();
> >>
> >>  would a be able to modify itself ? (unfortunately C# allows that)
> >
> >So does ruby.  We need that :)
> 
> I wasn't aware that ruby had value types--I thought it was all 
> reference types. Time to crack open the nutshell book again, 
> apparently.

Well, An object can certainly modify itself. 

: [bagfors@detrius]$ ; irb
irb(main):001:0> a="test"
"test"
irb(main):002:0> a.sub!('e','s')
"tsst"
irb(main):003:0> p a
"tsst"
nil


But they are still reference types.

irb(main):006:0> a="test"
"test"
irb(main):007:0> b=a
"test"
irb(main):008:0> a.sub!('e','s')
"tsst"
irb(main):009:0> p a
"tsst"
nil
irb(main):010:0> p b
"tsst"
nil

So I guess it just modifies the reference. (oh.. I really need to learn
more about low-level language-stuff...)

/Erik

-- 
Erik Bågfors               | [EMAIL PROTECTED]
Supporter of free software | GSM +46 733 279 273
fingerprint: 6666 A85B 95D3 D26B 296B 6C60 4F32 2C0B 693D 6E32

Reply via email to