824-1023 subjects 1215-1527
^ Reparenting a block
1009 [Dave thomase] Another block question. Is there any way to re-parent a Proc? For
+ 1010 [fukusima got] Really?
| 1011 [Dave thomase] Indeed it does! I misunderstood instance_eval, and thought you should
+ 1013 [matz netlab.] An Block has the bindings at the point where it appear, including
1016 [Dave thomase] In fact my interest started after I started poking around inside Tk
1018 [matz netlab.] It is because of performace/historical reason.
1019 [Dave thomase] Been there!
^ Is there a standard graphic/icon?
1020 [Dave thomase] If I'm putting together a web page featuring Ruby, is there a standard
1021 [yashi yashi.] I don't know which one is the _official_, but take a look and pick one
^ Tracing attributes
1024 [Dave thomase] I've been playing with a tracing module. One of the things it does is
1025 [matz netlab.] The answers to these questions are both `yes'.
^ Is this a bug?
1026 [Dave thomase] = 1
+ 1028 [gotoken math] Well, what charactor coding system did you used? Is that iso-8859-1?
| 1029 [Dave thomase] In the email, 8859-1. In the environment where I ran the Ruby script,
| + 1030 [decoux moulo] ruby was perhaps compiled with DEFAULT_KCODE == KCODE_EUC rather than
| | 1032 [decoux moulo] I want to say KCODE_NONE,
| + 1031 [gotoken math] Sorry, I can't find locale POSIX. If you use Emacs, would you tell me
| 1033 [Dave thomase] nil
| + 1034 [Dave thomase] But the re module is used to validate identifiers, and setting
| | 1042 [matz netlab.] How can we pick up one's environment? LANG?
| + 1035 [gotoken math] I see, it is iso-8859-1 (Emacs recognized as iso-latin-1-unix).
| 1036 [Dave thomase] Apart from the potential for confusion, I'm worried about
| 1038 [yashi yashi.] sorry to jump in the middle of the discussion but..
| 1041 [Dave thomase] Please do.
+ 1037 [matz netlab.] Because I have no knowledge about iso-8859-1, non ascii characters
+ 1039 [Dave thomase] I recompiled with KCODE=none and it worked fine, rejecting as a
+ 1040 [yashi yashi.] hmm... wouldn't it be better if we change the word "kcode" to more
| 1045 [matz netlab.] I agree with it. I'm thinking of `encoding', because Ruby does treat
+ 1043 [gotoken math] You can look all iso-8859-1 characters at
^ 8 bit characters - the plot thickens
1027 [Dave thomase] I'm getting confused.
^ en <-> ja translation site
1044 [yashi yashi.] I just noticed playing Mozilla M12+ that there is a site that traslate
^ Equivalent of 'inject'
1046 [Dave thomase] Now I know I'm being stupid, but I can't see a Ruby equivalent of
1047 [matz netlab.] If I remember correctly, inject works like this, right?
^ Extract args from binding?
1048 [andy Toolshe] Is there an easy way in Ruby to get the arguments of the function
1049 [matz netlab.] Hmm, there's no easy way.
^ Upper case method names
1050 [Dave thomase] This is really picky, but..
+ 1051 [matz netlab.] 5.8 Can I use an idenfier beginning with a capital letter for a
+ 1052 [gotoken math] Yes, you can. But the parentheses need to be put if the number
^ rand() / drand48()
1053 [decoux moulo] I was looking at random.c when I've seen that ruby use drand48() when it's
1055 [matz netlab.] Oops, I haven't noticed that. You're right. Here's the patch.
+ 1061 [gotoken math] But your patch is not suitable because a random generator function
| 1063 [matz netlab.] But drand48() family functions, which Ruby uses for most of the case,
| + 1064 [andy Toolshe] Perl's srand defaults to time(0L), but you can also call
| | 1065 [matz netlab.] Perl tries /dev/urandom if available.
| + 1068 [gotoken math] No. Well, I've thought again, then I can accept the behavoir like
| 1073 [matz netlab.] I don't get it, sorry. So do you think we should preserve this
| 1074 [gotoken math] Sorry for my unclear words. I agree your patch now, but you should
| 1075 [matz netlab.] rand(max)
| 1076 [gotoken math] I think that's enough. Thanks.
+ 1078 [komatsu sari] If HAVE_RANDOM is not defined, `first' would not be defined and
1081 [matz netlab.] Thank you for the patch. I'll apply it.
1054 [Dave thomase] If I override '..', is it true that I can only use it in functional
1056 [matz netlab.] Yes, and no.
1057 [Dave thomase] Thanks - that makes sense, although I did discover that
1058 [matz netlab.] That is caused by the same bug I mentioned in [ruby-talk:01056].
^ Locales and codesets
1059 [Dave thomase] I'm not an expert on internationalization, so please be patient...
1060 [matz netlab.] They are omitted from English document on purpose. I consider them as
1062 [gotoken math] I guess we desire M17N rather than I18N. M17N allows us to use of
^ Forward: Re: Re: rand() / drand48()
1066 [matz netlab.] I've received a personal reply from Andy. I'm forwarding it for
^ Here docs not skipping leading spaces
1067 [Dave thomase] I notice the code for stripping leading whitespace from <<-LABEL here
1069 [matz netlab.] Since we couldn't agreed how to remove leading whitespaces, it has
1070 [Dave thomase] 4. The whitespace at the start of the first line in the here document
1071 [yashi yashi.] How do you write if you want to indent the first line like this
1072 [Dave thomase] Well, one of the benefits of passing the text through transparently is
^ [[:alpha:]] and its friends
1077 [Dave thomase] Sorry to keep asking all these stupid questions, but...
1079 [matz netlab.] It's not sutupit at all. Thank you for the questions.
1080 [Dave thomase] Are \< and \> disabled for the same reason?
1082 [matz netlab.] No, it's because Perl's rule of regexp that all symbolic
^ YADQ (Yet Another Dumb Question)
1083 [Dave thomase] Why don't I get a warning for this (at either global scope or within a
+ 1085 [gotoken math] You are using ruby 1.5?
| + 1086 [Dave thomase] Indeed I am.
| | 1097 [matz netlab.] Even though I abandoned the idea of changing constants into shared
| + 1096 [matz netlab.] I haven't told anybody yet, but I changed my mind and abandoned the
+ 1093 [matz netlab.] =begin off-topic
+ 1094 [clemens.hint] Does that mean, we will not get any warning if this happen in
+ 1095 [Dave thomase] I think the concept of a constant is an important one--constants are
+ 1099 [yashi yashi.] I agree with that. However, quick search on ruby-dev, unfortunately
+ 1109 [matz netlab.] You can accomplish it by remove_const method
1110 [Dave thomase] In what circumstances are modules normally reloaded (rather than
1111 [matz netlab.] I'm thiking of interactive systems like browsers. This problem was
^ Infinite loop
1084 [Dave thomase] I don't know if this is a bug or expected behavior - I could argue it
1087 [yashi yashi.] it is expected behavior as far as I can tell. The method Array#=, or
+ 1088 [c.hintze gmx] perhaps I am wrong but I think the problem for Dave is, that it loops
| 1090 [Dave thomase] a = [1,2,3]
| 1092 [clemens.hint] But here we differ in opinion! In my eyes, this *is* necessarily a
| 1098 [matz netlab.] I agree. This is a bug.
| + 1100 [clemens.hint] To be true, on the first glance I had prefer also the second one. But
| + 1101 [Dave thomase] class Array
| 1102 [clemens.hint] No, please! I consider this a very nice property of Array#hash! But
| + 1103 [Dave thomase] THe reason it's not inconsistent is that Matz seeded the hash with
| | 1106 [matz netlab.] Hash would work as long as
| + 1105 [matz netlab.] Hmm, the only requirement for `hash' method is
| 1113 [decoux moulo] I've not understood, sorry. Do you mean
| + 1115 [matz netlab.] The former, i.e. forall a and b satisfy a.eql?(b), a.hash and b.hash
| + 1116 [Dave thomase] a. It's a neat thing, because it makes people stop and go 'oh!'
+ 1089 [Dave thomase] Thanks. I understand the above, though. I was interested that the
1091 [yashi yashi.] oops, sorry I mis-read you post ;p and thanks Clemens for pointing
^ The value of while...
1104 [Dave thomase] 'while' is an expression, and it always returns 'nil'.
1107 [matz netlab.] Yes.
1108 [Dave thomase] Not now, but I rather like the idea of
1112 [matz netlab.] Well, you need to change the behavior of `break' too.
1114 [Dave thomase] I guess my point is that this is the only place the concept of 'void
1117 [matz netlab.] Hmm, but it's a attribute of the statement which cannot be treated by
+ 1118 [Dave thomase] Let's look at another case. A class definition currently returns a
+ 1119 [c.hintze gmx] Perhaps that is the reason of confusion, IMHO. 'while' should be
1120 [matz netlab.] In Ruby's syntax, statement is just a special case of a expression
+ 1121 [clemens.hint] No! It is fine as it is :-)
| 1123 [matz netlab.] Is it?
| 1150 [schneiker ju] Only if you take that strategy more than a (very) few times. Even when you
| 1152 [c.hintze gmx] Hmmm! But I think, both could profite from Ruby. Furthermore, coming
| 1153 [matz netlab.] Maybe easy-to-understand expressive documents in BETTER English will
| 1154 [clemens.hint] Ehrm ... I have meant, that normally comp.lang.perl... will be very
+ 1122 [Dave thomase] Well we could make it smaller today. Remove the concept of void
| 1126 [matz netlab.] One does not have to seek smaller. That's the policy I learned from
| + 1128 [excalibor de] Sound pretty interesting!
| + 1131 [Dave thomase] My point was simply that they don't _have_ to be void -- there may be
| + 1132 [excalibor de] Well, I find this one pretty elegant, though ;) And original :)
| + 1136 [matz netlab.] I get it now. At present, 'void expressions' are ones introduced by
| 1138 [Dave thomase] I'd suggest that return's value is the value you're returning, and that
| 1145 [matz netlab.] It's bit weird for me. Because I feel returning value cannot be the
| 1146 [Dave thomase] def fred
+ 1124 [Dave thomase] Sorry to follow up the same post twice, but..
^ Class variables...
1125 [excalibor de] I am brand new to Ruby's world, but I find it pretty interesting... :)
+ 1127 [matz netlab.] Ruby does not have the class variables (yet).
| 1130 [clemens.hint] Answer already send ... :-) We are pro-active today, aren't we? :-)))
| 1133 [excalibor de] I thought Capital case identifiers were constants... Unless Population is a constant Array of 1 value, but the value inside the array is variable... ?
| 1134 [clemens.hint] Your are right. The variable is a constant. That means the content of
+ 1129 [clemens.hint] Class variables...
^ Factory of classes
1135 [excalibor de] I haven't had time to really munch over this, but I thought I give it a try in here in the meantime... :)
1137 [matz netlab.] The built-in Struct class is a such example.
1156 [matz netlab.] Let me explain this code more.
^ Bug in String
1139 [Dave thomase] I think it's because str_replace uses memcpy on an overlapping string
1140 [matz netlab.] Changing memcpy to memmove in rb_str_replace worked well.
1141 [Dave thomase] No... thank you for fixing it ;-)
1142 [Dave thomase] I wanted to make sure I understood continuations, so I thought I'd try
+ 1143 [matz netlab.] `again' was set. `scary' returns twice. once returns a continuation,
+ 1144 [decoux moulo] You have some examples in the japanese mailing-list. The examples are
^ struct / freeze
1147 [decoux moulo] I can't freeze a struct, it's normal ?
1148 [matz netlab.] Freezing is implemented for arrays, hashes, strings.
1149 [decoux moulo] I was writing a small extension with a hash, and I don't want that the
1151 [matz netlab.] There's no big reason.
^ Toward better English doc's. (Re: Re: The value of while...)
1155 [manamist whi] Would it be a clue??
^ [´äÀå] Welcome to our (ruby-talk ML) You are added automatically
1157 [PENWIZ choll] # guide
^ Is this expected behavior?
1158 [Dave thomase] Playing around with ranges, I bumped into this...
1159 [Dave thomase] Doh... answered my own question - it's a precedence thing.
1160 [matz netlab.] Do you prefer
1161 [Dave thomase] In general, I get nervous when whitespace makes that big a difference,
1165 [matz netlab.] The parser works very short sightedly. It is easy to throw warning on
1166 [Dave thomase] I doubt it ;-)
^ Possible bug in ruby-man-1.4
1162 [Dave thomase] Returns remainder of the numbers. In case either number is
1167 [matz netlab.] You are right. I'd like to hear your opinion about this.
1168 [Dave thomase] Well, I guess it comes down to what you mean by an integer
1171 [matz netlab.] Agree with it. According to the principle of less surprise, I'll
1172 [wang rjka.co] does this have anything to do with the following?
+ 1173 [Dave thomase] Sure is!
+ 1176 [matz netlab.] Yes, but precedence of ** operater is usually higher than unary minus
1177 [Dave thomase] Now there's a problem ;-(
+ 1178 [matz netlab.] That is the current behavior (without optimization).
| + 1179 [Dave thomase] Is that true, though? 1 + -2 seems to invoke 1.+, passing in negative
| | + 1181 [Dave thomase] Ooops. I'm wrong here. The tUMINUS Fixnum reduction only occurs when
| | + 1182 [matz netlab.] Sounds interesting, but maybe too danger. Let me think about.
| + 1180 [matz netlab.] Oops, I made mistake,
+ 1184 [gotoken math] Intuitively, -2**2 represents the mathematical notation
^ Pack options
1163 [andy Toolshe] Just a quick question about "pack". In the source, there a couple
1164 [aamine dp.u-] The M flag is "quoted printable" encoding, used in MIME message.
^ undef_method vs. remove_method
1169 [Dave thomase] OK - I guess I need to understand the source a bit better. What's the
1170 [matz netlab.] `undef_method' makes a method undefined, `remove_method' removes it.
^ == and eql?
1174 [Dave thomase] Can anyone think of a circumstance in the distributed Ruby library
1175 [matz netlab.] They are basically same except small difference in behavior on mixed
^ removing tainting
1183 [Dave thomase] Should the following sequence remove tainting?
1185 [matz netlab.] Oops, it's a bug.
^ Bug in chardev?
1186 [Andy Toolshe] Either I'm going blind, or there's a bug in File::Stat.chardev?
1187 [matz netlab.] Yes, it's a bug.
^ Enumerable and index
1188 [Dave thomase] Should there be a method Enumerable#index? It's documented in the 1.4
1189 [gotoken math] `index' is not helpful because one cannot access the object after
1190 [Dave thomase] I guess this is the difference between Iterable and
1191 [gotoken math] From the other point of veiw, most methods of Enumerable requires of
1192 [Dave thomase] If I understand your argument, then, enumerable _should_ have index
^ Semantics of chomp/chop
1193 [Dave thomase] I was wondering about the semantics of Kernel#chomp and
1194 [matz netlab.] Since there's no way to detect whether rb_str_chomp_bang will success,
1195 [Dave thomase] I was wondering why copy it at all, as all four methods are allowed to
+ 1196 [decoux moulo] $&
| 1204 [matz netlab.] No. It should be `the last pattern match attempt'.
+ 1203 [matz netlab.] foo = $_ = "foo\n"
1205 [Dave thomase] True enough - I wasn't thinking about an external reference to the
^ Question about 'open'
1197 [Dave thomase] f = open("|-", "w+")
+ 1198 [decoux moulo] I'm not really sure, but the block is executed in the parent process.
| 1199 [Dave thomase] D'accord! But I'm wondering why it is. The semantics of the open have
| 1200 [decoux moulo] i.e. make a special case for - ?
| 1201 [Dave thomase] Actually, I'd say that |<cmd> is the special case. The normal action
+ 1202 [matz netlab.] Oops, I forgot to execute a block in child process.
1206 [Dave thomase] Should I be applying these patches you're kindly generating, or will
1207 [matz netlab.] It will be merged into CVS tree in few days.
1208 [decoux moulo] LOCK_EX
1209 [matz netlab.] No, File#flock is based on system call flock(2), which does not aware
1210 [decoux moulo] pigeon% cat b.rb
1211 [matz netlab.] I see. File#flock can be used to exclude control flow within same
1212 [decoux moulo] OK, I've understood.
^ c-call and call in trace_func
1213 [Dave thomase] I'm trying to understand the difference between c-call and call events
1214 [matz netlab.] `c-call' for C defined method calls, `call' for for Ruby defined