[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: dump depth argument
From:       Tom Sawyer <transami () transami ! net>
Date:       2003-01-03 21:26:15
[Download RAW message or body]

On Friday 03 January 2003 01:58 pm, Dossy wrote:
> While the limit would be more useful if it weren't a hard limit but
> instead a suggested limit, it does behave as documented, IMHO.
>
> rb(main):090:0> rdio, wrio = IO.pipe
> [#<IO:0x40272c30>, #<IO:0x40272c1c>]
>
> irb(main):091:0> Marshal.dump(foo, wrio, 3); wrio.print "\n"; wrio.flush
> #<IO:0x40272c1c>
>
> irb(main):092:0> rdio.readline
> "\004\006o:\010Foo\006:\t@fooo:\010Bar\006:\t@bar\"\010baz\n"
>
> As I said, it'd be more interesting if the limit parameter to
> Marshal#dump simply stopped the recursive traversal of child
> objects at limit, instead of throwing an error ... but, I'm
> not the language implementer, so it's not my call to make ...

thanks Dossy, that's very helpful. now i finally know how to take an IO, use 
it and print it.

as for the hard limit, i agree. why raise an error? why not just stop there? 
well, i'm going to try to get it to do just that. with any luck i can rescue 
the error and flush what i have. we'll see.

thanks again,
transami



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic