[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Niggly Issues With Latest Version

jasonhutchens

1/12/2005 7:44:00 AM

Using the one-click under Windows. Interpreter version 1.8.2.

Language issues:
super doesn't behave like super()
you need to use return explicitly within an ensure
blah while and blah until don't behave like do...while in C

Other issues:
rdoc doesn't like mixing a list of directories with its other arguments
rubygems breaks require

Comments?

- jas.
5 Answers

Yukihiro Matsumoto

1/12/2005 7:56:00 AM

0

Hi,

In message "Re: Niggly Issues With Latest Version"
on Wed, 12 Jan 2005 16:46:18 +0900, jasonhutchens@gmail.com (Jason Hutchens) writes:

|Language issues:
| super doesn't behave like super()

Can you be more specific? What do you expect for super()?

| you need to use return explicitly within an ensure
| blah while and blah until don't behave like do...while in C

They are supposed to behave so, if I understand you correctly.

matz.


Joel VanderWerf

1/12/2005 8:44:00 AM

0

Jason Hutchens wrote:
> super doesn't behave like super()

Did they ever? I don't have 1.8.1 handy, but I think "super" has always
meant "call superclass method with same args" and "super()" has always
meant "call superclass method with no args".


georgesawyer

1/12/2005 3:05:00 PM

0

jasonhutchens@gmail.com (Jason Hutchens) Jan 11, 2005 at 11:43 PM wrote:
>Using the one-click under Windows. Interpreter version 1.8.2.
>Language issues:
> blah while and blah until don't behave like do...while in C
>Comments?

->print 'before ' ;begin print 'hello ' end while false
before hello nil
->print 'before ' ;begin print 'hello ' end until true
before hello nil
->system 'ruby --version'
ruby 1.8.2 (2004-07-29) [i386-mswin32]

From _Programming Ruby_:
"While and Until Modifiers:
expression while boolean-expression
expression until boolean-expression
If expression is anything other than a begin/end block, executes
expression zero or more times while boolean-expression is true (false for
until). If expression is a begin/end block, the block will always be
executed at least one time."

"Block Expressions:
begin
body
end
Expressions may be grouped between begin and end. The value of the block
expression is the value of the last expression executed."

Differs from (note the capitalization):

"BEGIN and END Blocks: Every Ruby source file can declare blocks of code
to be run as the file is being loaded (the BEGIN blocks) and after the
program has finished executing (the END blocks).
BEGIN {
begin code
}
END {
end code
}
A program may include multiple BEGIN and END blocks. BEGIN blocks are
executed in the order they are encountered. END blocks are executed in
reverse order."
Cordially,

Glenn Parker

1/12/2005 3:27:00 PM

0

Yukihiro Matsumoto wrote:
> In message "Re: Niggly Issues With Latest Version"
> on Wed, 12 Jan 2005 16:46:18 +0900, jasonhutchens@gmail.com (Jason Hutchens) writes:
>
> | blah while and blah until don't behave like do...while in C
>
> They are supposed to behave so, if I understand you correctly.

I stumbled on this one myself, although I'm not sure it's a bug, and
it's not a 1.8.2 issue.

The following two lines behave differently, and it's not obvious why.

puts 'x' until true

begin puts 'x' end until true

This first example prints nothing. The second example above prints 'x'.
In C, the body of a do/while loop always executes at least once, as in
the second example. The failed assumption is that the first example is
just a shorter version of the second example.

--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoi...


Yukihiro Matsumoto

1/12/2005 3:34:00 PM

0

Hi,

In message "Re: Niggly Issues With Latest Version"
on Thu, 13 Jan 2005 00:27:08 +0900, Glenn Parker <glenn.parker@comcast.net> writes:

|The following two lines behave differently, and it's not obvious why.
|
| puts 'x' until true
|
| begin puts 'x' end until true

Yes, and this is an evidence that I have made mistakes in the language
design sometimes.

matz.