[#4734] Possible regex bug? — hal9000@...
OK, I'm trying to match an optional comma followed by
[#4744] Piping in Ruby? — Stephen White <steve@...>
There's one construct I miss from shell scripts... The ability to pipe the
[#4766] Wiki — "Glen Stampoultzis" <trinexus@...>
Hi, Glen,
Howdy,
> I asked him/her. He/She opened the new site using tiki-1.0.4.
Hi, Glen,
Howdy,
[#4769] unix 'time' in Ruby? — Robert Feldt <feldt@...>
Hi.
[#4774] Module vs. Class — Jilani Khaldi <jilanik@...>
Hi,
[#4776] Listing methods in a module — DaVinci <bombadil@...>
Hi all. I need a little help :)
[#4792] closures — Stuart Zakon <zakons@...>
Can somebody please explain what a closure is within the context of
[#4809] Some questions — Friedrich Dominicus <frido@...>
[#4849] FEATURE REQUEST: Fixnum bitfields — Wayne Scott <wscott@...>
Hi,
[#4883] Re-binding a block — Dave Thomas <Dave@...>
matz@zetabits.com (Yukihiro Matsumoto) writes:
[#4916] Re: [TOY] FL — Andrew Hunt <andy@...>
> I still don't understand sorry.
[#4930] Perl 6 rumblings -- RFC 225 (v1) Data: Superpositions — Conrad Schneiker <schneik@...>
Hi,
[#4936] Ruby Book Eng. translation editor's questions — Jon Babcock <jon@...>
Nobody cares about this but me,
Thanks very much for the input.
SugHimsi.
,
[#4951] What do I need to compile 1.4? — "Glen Stampoultzis" <trinexus@...>
Platform is Windows 98
[#4987] Ruby Book Ch 2 English -- arguments/parameters/options? — Jon Babcock <jon@...>
Once again, I must impose on your good graces.
[#4992] Re: Perl 6 rumblings -- RFC 225 (v1) Data: S uperpositions (fwd) — Aleksi Niemel<aleksi.niemela@...>
Michael dared to suggest, and was probably right:
[#5009] Re: Ruby Book Ch 2 English -- arguments/parameters/options? — "Dat Nguyen" <thucdat@...>
[#5011] Changes in 1.6.0 — matz@... (Yukihiro Matsumoto)
Hi,
[#5013] A QuantumSuperposition Proposal for Ruby — Huayin Wang <wang@...>
# I have been play around the QuantumSuperpositions idea today and
[#5028] A Tru64 problem and ruby-talkietiquette — Aleksi Niemel<aleksi.niemela@...>
I just saw this (the little I could see in English)
[#5033] Having problems with Net::HTTP::do_finish — Dan Schmidt <dfan@...>
I just started using Ruby yesterday, and I'm having trouble with my
[#5045] Proposal: Add constants to Math — Robert Feldt <feldt@...>
Hi,
On Sat, 23 Sep 2000, Yukihiro Matsumoto wrote:
Hi,
On Fri, 22 Sep 2000, Masahiro Tanaka wrote:
>From: Robert Feldt <feldt@ce.chalmers.se>
[#5061] Proposal: Add rubycpp.h or include in ruby.h — Robert Feldt <feldt@...>
[#5070] Ruby Book 2.18, Eng.tl, kesaran pasaran? — Jon Babcock <jon@...>
From Ruby Book 2.18:
[#5077] Crazy idea? infix method calls — hal9000@...
This is a generalization of the "in" operator idea which I
[#5082] Application Error in 1.6.0 on Win2K — "Kevin Burge" <kcbspam@...>
I've created a 1.6.0 ruby extension (1.6.0 (2000-09-19) [i586-mswin32]),
[#5092] RE: Hanging require — Aleksi Niemel<aleksi.niemela@...>
> ruby -v a.rb
[#5114] Types and === — hal9000@...
<sigh> I imagine Yoda behind me, shaking his little green head
[#5157] Compile Problem with 1.6.1 — Scott Billings <aerogems@...>
When I try to compile Ruby 1.6.1, I get the following error:
[#5161] Re: Types and === — schneik@...
[#5175] Compiling 1.6.1 problem — Tony Reed <Callus@...>
Compiling Ruby 1.6.1 fails:
Hi,
On 9/29/00, Yukihiro Matsumoto wrote:
From: Tony Reed <Callus@Sympatico.CA>
[ruby-talk:4909] Re: [TOY] FL
> I've written this small module, just to play with ruby.
>
> It has probably many bugs and probably work only with this example, this
> is *really* only a toy :-)
Well now you've let the cat out of the bag :-)
I wrote a DBC implementation a few weeks ago, but was waiting until
we had our web site in better shape before I unleashed it to the
world.
Mine's pretty similar; but a bit more automatic. It takes care of all the
necessary calls to super, arranges for "old" values to be set correctly,
and such. In my scheme, the invariants and pre/post conditions must
return true; otherwise, an appropriate DBC exception is thrown.
You don't need to inherit from anything special (you do need to
require 'dbc'), and you can selectively turn on/off various levels
of error reporting.
Perhaps we should work together on this instead of duplicating
effort?
Here's an excerpt from the documentation, hastily edited from
the LaTeX source (and not proofread!)
-------------------------------------------------------------
The specific features added to Ruby include Pre- and Postconditions,
"old" expressions, Invariants, and a basic assertion check.
Assertions made in a superclass apply to all subclasses.
Ruby source files that participate in DBC need to require 'dbc'
to get the following features.
Pre- and Postconditions
----------------------
Immediately following a method declaration, a precondition and/or a
postcondition may optionally be defined:
def someMethod
pre {
{a code block that must evaluate to true...}
}
post {
{a code block that must evaluate to true...}
}
...
{normal method code...}
...
end
Invariants and postconditions specified in one class will be checked
in all subclasses as well, preconditions in a subclass will override
any parent's precondition. You are allowed to weaken
preconditions in a subclass, but can only strengthen
postconditions.
The pre- and postcondition clauses may span several lines or may be placed
on a single line each.
old expressions
--------------
Postconditions may refer to expressions as they existed before the
method call with the syntax:
old(expr)
This syntax is only valid within a postcondition; the parentheses are
required.
Result
------
Often a postcondition may want to verify the return value of its
method:
DBC.result
For example, the following method asserts that the result of
alpha times two equals the original argument, x.
def alpha(x)
post { DBC.result * 2 == x }
x/2
end
Invariant
---------
Any class may define a method called invariant, which will be
called at the conclusion of any public instance method within the class.
A class's invariant must evaluate to true any time a public method
returns (by any means).
When the invariant is checked, any invariants that exist in superclasses
are checked automatically.
The invariant should be the last method defined in a class.
Check
-----
To simply check an assertion in-line within a method, we have the following
routine:
check "Descriptive string" { code block }
The code block must evaluate to true.
implies
-------
Many times you want to check a particular condition, but only if some
other condition is true. For this we have the method implies:
implies(a,b)
If a is true, then the return value of implies is the value of b.
If a is false, then the return value is true. That is, you
only will get a false if ``a implies b'' is false---when a is true
and b is not.
Exceptions
----------
If a check, invariant, pre- or postcondition is violated
(i.e., the assertion returns false), an exception is raised with
the name of the type of the violation (invariant, precondition, etc.)
and a user-supplied message (if available).
Once an exception has been raised from an object, that object should
not be considered viable any more. In particular, it may not detect
further contract violations correctly (since the state of the object
is already inconsistent, it probably won't do anything else correctly
either!)
Enabling/Disabling
------------------
By default, DBC is enabled with full checking. To change the checks
which are performed, call DBC.enable with one or more of the
following flags or-ed together:
DBC::PRE Check Precondition assertions
DBC::POST Check Postcondition assertions
DBC::INV Check Invariant assertions
DBC::CHECK Check ``check'' assertions
DBC::NONE Don't check any assertions
Limitations
------------
dbc.rb must be able to find and parse the source code, so you
cannot pipe the program source into ruby, nor can you specify
assertions in an eval.
Assertions are only recognized within the context of methods in user
defined classes. Top-level methods (implicitly of class Object)
will not be examined for assertions.
Your program may run a bit slower with all the extra checking. In
particular, if the invariant is computationally expensive, you may see
a dramatic difference.