[#3101] Compile_err — "Fergus Hayman" <shayman@...>
[#3109] Is divmod dangerous? — Dave Thomas <Dave@...>
[#3110] my wish list for Ruby — Mathieu Bouchard <matju@...>
[#3119] Re: Min and max? — ts <decoux@...>
>>>>> "M" == Mathieu Bouchard <matju@CAM.ORG> writes:
[#3149] Retrieving the hostname and port in net/http — Roland Jesse <jesse@...>
Hi,
[#3154] 3-d arrays? — Hugh Sasse Staff Elec Eng <hgs@...>
Is there an idiom for 3-dimensional arrays in Ruby? I see that
[#3167] ruby.h needed to compile Interbase module — Jilani Khaldi <jilanik@...>
Hi all,
[#3189] BUG or something? — "Park Hee Sob" <phasis@...>
Hi,
[#3221] Re: Ruby & Interbase -- Please answer if you know! — ts <decoux@...>
>>>>> "J" == Jilani Khaldi <jilanik@tin.it> writes:
[#3222] Ruby coding standard? — Robert Feldt <feldt@...>
On Fri, 9 Jun 2000, Robert Feldt wrote:
Mathieu Bouchard <matju@cam.org> wrote:
[#3277] Re: BUG or something? — Aleksi Niemel<aleksi.niemela@...>
> |I am new to Ruby and this brings up a question I have had
Aleksi Niemel<aleksi.niemela@cinnober.com> writes:
On 12 Jun 2000, Dave Thomas wrote:
ts <decoux@moulon.inra.fr> writes:
[#3296] RE: about documentation — Aleksi Niemel<aleksi.niemela@...>
> I want to contribute to the ruby project in my spare time.
Aleksi Niemel<aleksi.niemela@cinnober.com> writes:
Hi,
On Tue, 13 Jun 2000, Toshiro Kuwabara wrote:
Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
[#3331] Selling Rubies by the Carat — Dave Thomas <Dave@...>
[#3338] PID of child processes — Andrew Hunt <Andy@...>
[#3363] chomp! — "David Douthitt" <DDouthitt@...>
I was looking at the documentation for chomp and chomp! - and the results of chomp startled me to say the least.
"David Douthitt" <DDouthitt@cuna.com> writes:
[#3407] Waffling between Python and Ruby — "Warren Postma" <embed@...>
I was looking at the Ruby editor/IDE for windows and was disappointed with
[#3410] Exercice: Translate into Ruby :-) — Jilani Khaldi <jilanik@...>
Hi All,
Jilani Khaldi <jilanik@tin.it> writes:
Hi,
"NAKAMURA, Hiroshi" <nahi@keynauts.com> writes:
Hi, Dave,
Hello,
[#3453] Re: Static Typing( Was: Waffling between Python and Ruby) — Andrew Hunt <andy@...>
[#3515] Options database (was: Define & Include?) — claird@... (Cameron Laird)
In article <8ikot4$ki$0@216.39.170.247>, Dave LeBlanc <whisper@oz.net> wrote:
[#3516] Deep copy? — Hugh Sasse Staff Elec Eng <hgs@...>
Given that I cannot overload =, how should I go about ensuring a deep
In message "[ruby-talk:03516] Deep copy?"
On Tue, 20 Jun 2000, GOTO Kentaro wrote:
[#3532] Extension in C++? — Robert Feldt <feldt@...>
[#3541] function objects? — Johann Hibschman <johann@...>
Hi folks,
[#3544] A small quiz — Dave Thomas <Dave@...>
[#3588] Interface polymorphism — hal9000@...
Another question, guys.
[#3607] Is there a statistician in the house? — Dave Thomas <Dave@...>
[#3662] Ruby 1.4.5 install from Mandrake cooker rpms ?problem? — Charles Hixson <charleshixsn@...>
This is the first time that I've installed ruby, so
[#3685] no traffic — matz@... (Yukihiro Matsumoto)
Hi,
[#3694] Why it's quiet — hal9000@...
We are all busy learning the new language
Hi,
Hi,
Hi, matz,
Hi,
Hi,
[#3699] Multithreaded/Embedded Ruby? — "Warren Postma" <embed@...>
Is there any information on Thread safety in ruby. Suppose I embed Ruby in a
Hi,
[ruby-talk:03067] Re: FailureClass?
Dave:
> Why don't the proponents of the idea get together and redefine a
> portion of the built-in library to use a FailureClass. Publish the
> result so we can all see what the implications are, good and bad.
Dave, your proposal is perfectly fine. I hardly dare to announce my Ruby
abilities barely exceed total beginner who had read all the currently
available material once. If only I had such insight and wisdom as you and
many others on the list seem to have I'd be not only much better coder and
developer but a Ruby developer. Then such test would be done in no time but
now it's better to dig the grave for stupid thoughts with help from the
others.
My style has been so far, and in the future unless I get requests to do
otherwise, to raise different topics, cases and pieces of code under some
peer thought and design. Most of the time I miss the target (at least 80%)
but every now and then I feel I might have hit the spot and if we're not
getting better Ruby at least have I managed to provide some thought-food for
powerful and wise brains.
This FailureClass is probably one of my personal failures or misses but
hopefully it has cleared the nature of Ruby for someone else than me too.
In any case, I agree that the best way to communicate would be to develop
the random thought or the idea, raise it and when it's mature, tested and
personally evaluated to be able to survive, discuss about it with others. I
do, however, lack abilities to do so. So I raise an issue and let the
people, you, express their viewpoint and judge.
Now, I got your counter arguments and I'm very happy.
> However, I have a problems with the idea:
> 1. Performance.
> 2, Clarity.
If the FailureClass is the right way to go it should be implemented in a
interpreter and be as fast as possible. I agree the kind_of? trick not only
makes code uglier but is probably slower too.
> 3. Symmetry.
> if failure is not false, then
> "dog" =~ /cat/
> would be true, which would be somewhat confusing?
I see your point. Failure should be evaluated to false in boolean context.
But apart from that I feel my thoughts are not clear yet. I seem to have a
problem about double meaning of nil and my first solution was to make:
- failure = FailureClass.new(), and use (return) failure when
something requested can't be done
- nil, and use it to specify something is undefined
So let's see. If 'gets' returns a string if it's able to perform it's
function and failure if the stream is at the end
while str = gets
print str
end
would work five if failure is false in the test. Then assume we have
getNextPacket which returns:
- instance of Packet if it can, this means that it could return
- nil if the packet is undefined (for example the packet was totally
broken)
- failure if it can't get next packet
while packet = getNextPacket
print packet.content if packet
end
Now we have two different possible meanings here. At 'while' we would like
to check if the returned packet is not a failure, and process it if
everything is fine. That means that nil has to pass the test. On the other
hand 'if' would like to check if the packet is really defined because we
can't print an undefined packet. So we can't allow nil to be printed and
that means nil shouldn't pass the test.
So maybe the code should be
print packet.content if defined? packet
Which in turn leads to my second thought. The FailureClass was proposed
because nil gives me feeling of null which has been the symbol denoting
undefined in the databases world (and widely elsewhere too). But we can turn
the tables and let nil be as it is and introduce UndefinedClass instead.
Then nil would retain the meaning of failure. 'defined?' would return
kind_of?(UndefinedClass) or something.
My example probably sucks, but it doesn't matter. I'm sure this version is
as bad thing as the original, but I'm happy to hear your thoughts.
(Actually, the real reason is that this mail is way too long already. :)
- Aleksi