Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Re: Freezing OpenStruct

    Hi,

    In message "Freezing OpenStruct"
    on 03/08/26, Gavin Sinclair <gsinclair@soyabean.com.au> writes:

    |The irb session below demonstrates that OpenStruct objects (part of
    |the standard library) allow modification after a #freeze. Is this
    |desirable?

    I forgot to check frozen status. Thanks.

    matz.

    Yukihiro Matsumoto Guest

  2. Similar Questions and Discussions

    1. Contribute 3 freezing
      I use a Mac Mini and have downloaded the trial version of Contribute 3. I'm not a technical wiz but also not a technophobe & I like to think that...
    2. Freezing while Loading ~~~HELP~~~
      My Illustrator 10 on windows XP keeps freezing during the loading stage. It says reading fonts but does nothing else after that. What can I do. The...
    3. TERMINALS ARE FREEZING
      Hello, I have a 43P running AIX 4.3.3 with three RANs attached to it. Recently the system is freezing selectively terminals and printer. I...
    4. ASP.NET freezing
      Ok, I realize this is a fairly open-ended question, but I'm not entirely sure what caused this or how it happened. My application draws a graph...
    5. Freezing a Pattern
      I scanned a polish green marble slab and created marble pattern with it. I use this pattern on text. My problem is that every character takes on a...
  3. #2

    Default Re: Freezing OpenStruct

    On 2003-08-26 21:39:34 +0900, Gavin Sinclair wrote:
    > The irb session below demonstrates that OpenStruct objects (part of
    > the standard library) allow modification after a #freeze. Is this
    > desirable?
    It don't think so. A quick fix would be that:

    Index: ostruct.rb
    ================================================== =================
    RCS file: /src/ruby/lib/ostruct.rb,v
    retrieving revision 1.6
    diff -u -p -r1.6 ostruct.rb
    --- ostruct.rb 18 Nov 2002 20:09:46 -0000 1.6
    +++ ostruct.rb 26 Aug 2003 15:05:08 -0000
    @@ -38,6 +38,11 @@ class OpenStruct
    @table.delete name.to_sym
    end

    + def freeze
    + super
    + @table.freeze
    + end
    +
    def inspect
    str = "<#{self.class}"
    for k,v in @table

    --
    Simplicity is prerequisite for reliability. [Handwritten annotation]
    -- Edsger Dijkstra, How do we tell truths that might hurt?

    Florian Frank Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139