[ruby-talk:02423] Re: Marshal: Want string out, but want depth specified?

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-04-10 10:45:51 UTC
List: ruby-talk #2423
On Mon, 10 Apr 2000, Yukihiro Matsumoto wrote:

> Hi,
> 
> In message "[ruby-talk:02421] Re: Marshal: Want string out, but want depth specified?"
>     on 00/04/10, Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
> 
> |> Hmm, I designed this to work.  And works fine on my box.  The only
> |> limitation I can think of is depth must be a Fixnum.
> |
> |I think I tried it with a value of 10.  I am using 1.4.3.  Can I get
> |better diagnositcs out somehow, so you can see why this doesn't work
> |on my system, please?
> 
> Could you submit a problem reproducing script and precise error

Well, in the mean time I took out the explicit depth spec, so I could get
on with development.  Now I have put it back, it works as you say.  The
line I put in the e-mail was cut and pasted from the code, so I don't know
what happened, now!

brains hgs 91 %> diff Encode.rb Encodebug.rb   
3a4
> # modified to demonstrate tbe bug with depth.
33c34
<     def initialize(thing, code = true)
---
>     def initialize(thing, code = true, depth=100)
36c37
<             @encoded = [Marshal.dump(@decoded)].pack("m")
---
>             @encoded = [Marshal.dump(@decoded,depth)].pack("m")
66c67
<     e = Encoded.new(x)
---
>     e = Encoded.new(x, true, 20)
brains hgs 92 %> 

Which means this is the same syntax I had before> 
> |@encoded = [Marshal.dump(@decoded, depth)].pack("m")
> |
> |doesn't work, the second param needs to be type IO
> 

Oh, well, I have a working solution now.  Sorry for taking up your
time with this. 

Lesson learned from this:  It *is* worth putting buggy versions into
RCS, so that they can be recovered for rigorous scrutiny.

> message?  Probably via http://www.ruby-lang.org/cgi-bin/ruby-bugs
> 
> 							matz.
> 

	Thank you.
	Hugh
	hgs@dmu.ac.uk


In This Thread

Prev Next