[#4341] DRY and embedded docs. — Hugh Sasse Staff Elec Eng <hgs@...>
If I have a here document in some ruby program:
[#4347] Re: DATA and rewind. — ts <decoux@...>
>>>>> "H" == Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
[#4350] Re: Thirty-seven Reasons [Hal Fulton] Love[s] Ruby — "David Douthitt" <DDouthitt@...>
[#4396] Re: New Require (was: RAA development ideas (was: RE: Looking for inp ut on a 'links' page)) — Hugh Sasse Staff Elec Eng <hgs@...>
On 9 Aug 2000, Dave Thomas wrote:
[#4411] Re: RAA development ideas (was: RE: Lookin g for inp ut on a 'links' page) — Aleksi Niemel<aleksi.niemela@...>
Me:
On Thu, 10 Aug 2000, [iso-8859-1] Aleksi Niemelwrote:
[#4465] More RubyUnit questions. — Hugh Sasse Staff Elec Eng <hgs@...>
I am beginning to get a feel for this, but I still have a few more
[#4478] Re: RubyUnit. Warnings to be expected? — ts <decoux@...>
>>>>> "H" == Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
[#4481] Invoking an extension after compilation — Dave Thomas <Dave@...>
Hi,
[#4501] What's the biggest Ruby development? — Dave Thomas <Dave@...>
[#4502] methods w/ ! giving nil — Hugh Sasse Staff Elec Eng <hgs@...>
I have got used to the idea that methods that end in '!' return nil if
[#4503] RubyUnit and encapsulation. — Hugh Sasse Staff Elec Eng <hgs@...>
My_class's instance variables are not all "attr :<name>" type variables,
[#4537] Process.wait bug + fix — Brian Fundakowski Feldman <green@...>
If your system uses the rb_waitpid() codepath of rb_f_wait(),
[#4567] Re: What's the biggest Ruby development? — Aleksi Niemel<aleksi.niemela@...>
Dave said:
Robert Feldt <feldt@ce.chalmers.se> writes:
On Sat, 26 Aug 2000, Dave Thomas wrote:
Robert Feldt <feldt@ce.chalmers.se> writes:
On Mon, 28 Aug 2000, Dave Thomas wrote:
Robert Feldt <feldt@ce.chalmers.se> writes:
[#4591] Can't get Tcl/Tk working — Stephen White <steve@...>
I can't get any of the samples in the ext/tk/sample directory working. All
I'm sure looking forwards to buying the book. :)
Stephen White <steve@deaf.org> writes:
On Sun, 27 Aug 2000, Dave Thomas wrote:
Stephen White <steve@deaf.org> writes:
[#4608] Class methods — Mark Slagell <ms@...>
Reading the thread about regexp matches made me wonder about this:
[#4611] mod_ruby 0.1.19 — shreeve@...2s.org (Steve Shreeve)
Shugo (and others),
[#4633] Printing tables — DaVinci <bombadil@...>
Hi.
[#4647] Function argument lists in parentheses? — Toby Hutton <thutton@...>
Hello,
[#4652] Andy and Dave's European Tour 2000 — Dave Thomas <Dave@...>
Hi,
[#4672] calling super from c — Robert Feldt <feldt@...>
[#4699] Double parenthesis — Klaus Spreckelsen <ks@...1.ruhr-uni-bochum.de>
Why is the first line ok, but the second line is not?
[ruby-talk:04450] Few random notes
Here're few random notes I've written down for myself. Maybe some of them
have something good behind them, so you maybe want to consider them.
- Aleksi
=begin
Something about hashes:
Hash#[]= shouldn't delete when said hash[key]=nil .
At least I should be able to select the behaviour.
Hash#sort could have calling form with block.
There should be appending version of Hash#invert and update, so that
ruby -e'a={"a"=>"c", "b"=>"c"}.invert; p a'
{"c"=>"b"}
would say {"c" => ["a", "b"]}.
=end
=begin
MatchData is not data by itself, it points to $1, $2,... So
this doesn't work:
ruby -e's="foo bar"; m1=/bar/.match s; m2=/foo/.match s; p m1[0...1];'
["foo"]
But this does:
ruby -e's="foo bar"; m1=/bar/.match(s).dup; m2=/foo/.match(s).dup; p
m1[0...1];'
["bar"]
Except that it does not:
ruby -e's="foo bar"; m1=/bar/.match(s).dup; m2=/for/.match(s).dup; p
m1[0...1];'
/tmp/rbREtzJK:1:in `clone': can't clone nil (TypeError)
from /tmp/rbREtzJK:1:in `dup'
from /tmp/rbREtzJK:1
So working nicely with regexps is a little bit tedious. It wouldn't have to
be (but it would be slower with autodupping).
=end
=begin
a, b = [1,2] # is very different from
a, b, c = [1, 2], 3 # where a=[1,2], b=3, c=nil
(a, b), c = [1, 2], 3 # correct form
There's no bug here, I guess, just a note that one have to be careful.
=end
=begin
Emacs notes:
- indentation:
- when or regexp
when %r|^GET\s+/setup(.*)|
parameters = $1 # two chars too much
print standard_setup
=end
=begin
ruby -e 'class Kernel; def foo; end; end;'
1: Kernel is not a class (TypeError)
How about reporting what it is (module in this case)?
=end
=begin
RubyUnit assertions should be added to object too (on request), so
instead of
assert_kind_of(key, Array)
one should say
key.assert_kind_of Array
And actually my first example is wrong as it should be
assert_kind_of(Array, key)
and is small gotcha for me. Learnable anyway.
(Should we consider assert_kind_of! as a exceptional and extreme case, as
we actually want shout it out! Key just *have to be* Array! :)
Testsuite should have alias add for add_test.
=end
=begin
if data.something?
data.then_proceed
else data.something_else_perhaps?
data.should_fail?
end
Following passes parser easily probably just as wanted, maybe it's
just a gotcha. Gotcha is that the code looks like and should have been
using 'elsif'. Maybe we should force 'term' if 'else' clause has some other
code on the same line? Or warning perhaps.
=end