This is a multi-part message in MIME format.
------ extPart_000_0067_01C1C99F.EDC2BC70
Content-Type: text/plain;
charset so-8859-1"
Content-Transfer-Encoding: quoted-printable
Here are a few thing I am considering submitting as RCRs. I'm looking for comments to help decide whether to make them official, so please let know what you think is good and bad about these...
------------------
"p" method should return its last argument, unconverted.
(It currently returns nil.) This would allow it to be more conveniently inserted into expressions during debugging:
E.g. in
a = d + b / c
To quickly see what the subexpression (b / c) is producing
a = a + p(b / c)
or
a = d + p("***** b / c:", b / c)
------------------
A format specification in "printf"-type formats that inserts the result of applying "inspect" to the argument.
E.g. "Value of x: %r\n" % x.
This is more convenient than typing ".inspect". There are some other reasons why it is better to specify inspectness in the format rather than pre-evaluating inspectness in the argument. One is for specifying logging messages: the inspect string need not be computed if the logging message is suppressed. I used %r in my example only because it is used in Python for the same functionality, which I find useful. Python uses %r because their equivalent of "inspect" is "repr" -- for Ruby a different letter might be better. Too bad %i is already overloaded for integers!
------------------
A "println" method.
Would work just like "print" but would tack on a newline. Yeah, I know it doesn't seem much different than just coding "\n" as a final parameter, but I find "println" more pleasing and more self-describing
------------------
String#count should also accept Regexp as argument.
Would extend the power of this method.
------------------
Dir methods that produce directory entries should never produce "." and "..".
I see no use in producing "." and "..", and it is a nuisance having to explicitly filter them out (usually after forgetting to do it and getting a program error!) Also, seems a tad non-portable.
------------------
The built-in Mutex object should be nestable.
Acquiring a mutex in nested contexts in the same thread should not cause deadlock. It doesn't seem appropriate for a language at Ruby's level to have a non-nestable Mutex, and it is a pothole for program errors.
------------------
A "message" parameter for "abort".
Coding
abort("the program did something bad")
would print the message before terminating.
Note:
Python does something kind of nifty in this area which I like:
exit() exits with code=0
exit(22) exits with code=22
exit("bad bad") prints "bad bad" and exits with code=1
I think this would be a good thing in Ruby too (hey, the Python camp seems to be very busy lately copying Ruby's good ideas!)
------------------
Enhanced ObjectSpace finalizer operations
I started a separate thread on this: "Thoughts on WeakRefs and ObjectSpace".
Bob
------ extPart_000_0067_01C1C99F.EDC2BC70
Content-Type: text/html;
charset so-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4913.1100" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Here are a few thing I am considering submitting as
RCRs. I'm looking for comments to help decide whether to make them official, so
please let know what you think is good and bad about these...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>"p" method should return its last argument,
unconverted.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>(It currently returns nil.) This would allow it to
be more conveniently inserted into expressions during debugging:</FONT></DIV>
<DIV><FONT face=Arial size=2>E.g. in</FONT></DIV>
<DIV><FONT face=Arial size=2> a = d + b / c</FONT></DIV>
<DIV><FONT face=Arial size=2>To quickly see what the subexpression (b / c) is
producing</FONT></DIV>
<DIV><FONT face=Arial size=2> a = a + p(b / c)</FONT></DIV>
<DIV><FONT face=Arial size=2>or</FONT></DIV>
<DIV><FONT face=Arial size=2> a = d + p("***** b / c:", b
/ c)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>------------------</FONT></DIV></FONT><FONT
face=Arial size=2></DIV>
<DIV>A format specification in "printf"-type formats that inserts the result of
applying "inspect" to the argument.</DIV>
<DIV> </DIV>
<DIV>E.g. "Value of x: %r\n" % x.</DIV>
<DIV> </DIV>
<DIV>This is more convenient than typing ".inspect". There are some other
reasons why it is better to specify inspectness in the format rather than
pre-evaluating inspectness in the argument. One is for specifying
logging messages: the inspect string need not be computed if the logging
message is suppressed. I used %r in my example only because it is used in Python
for the same functionality, which I find useful. Python uses %r because their
equivalent of "inspect" is "repr" -- for Ruby a different letter might be
better. Too bad %i is already overloaded for integers!</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>------------------</FONT></DIV>
<DIV>A "println" method.</DIV>
<DIV> </DIV>
<DIV>Would work just like "print" but would tack on a newline. Yeah, I know it
doesn't seem much different than just coding "\n" as a final parameter, but
I find "println" more pleasing and more self-describing</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>------------------</FONT></DIV>
<DIV>String#count should also accept Regexp as argument.</DIV>
<DIV> </DIV>
<DIV>Would extend the power of this method.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>------------------</FONT></DIV>
<DIV>Dir methods that produce directory entries should never produce "." and
"..".<BR></DIV>
<DIV>I see no use in producing "." and "..", and it is a nuisance having to
explicitly filter them out (usually after forgetting to do it and getting a
program error!) Also, seems a tad non-portable.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>
<DIV><FONT face=Arial size=2>------------------</FONT></DIV>
<DIV>The built-in Mutex object should be nestable.</DIV>
<DIV> </DIV>
<DIV>Acquiring a mutex in nested contexts in the same thread should not cause
deadlock. It doesn't seem appropriate for a language at Ruby's level to have a
non-nestable Mutex, and it is a pothole for program errors.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>
<DIV><FONT face=Arial size=2>------------------</FONT></DIV></DIV>
<DIV>A "message" parameter for "abort".</DIV>
<DIV> </DIV>
<DIV>Coding</DIV>
<DIV> </DIV>
<DIV> abort("the program did something bad")</DIV>
<DIV> </DIV>
<DIV>would print the message before terminating.</DIV>
<DIV> </DIV>
<DIV>Note:</DIV>
<DIV>Python does something kind of nifty in this area which I like:</DIV>
<DIV> exit() exits with code=0</DIV>
<DIV> exit(22) exits with code=22</DIV>
<DIV> exit("bad bad") prints "bad bad" and exits with code=1</DIV>
<DIV>I think this would be a good thing in Ruby too (hey, the Python camp seems
to be very busy lately copying Ruby's good ideas!)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>
<DIV><FONT face=Arial size=2>------------------</FONT></DIV></DIV>
<DIV>Enhanced ObjectSpace finalizer operations</DIV>
<DIV> </DIV>
<DIV>I started a separate thread on this: "Thoughts on WeakRefs and
ObjectSpace".</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Bob</DIV></DIV></FONT></BODY></HTML>
------ extPart_000_0067_01C1C99F.EDC2BC70--