[#6954] Why isn't Perl highly orthogonal? — Terrence Brannon <brannon@...>

27 messages 2000/12/09

[#7022] Re: Ruby in the US — Kevin Smith <kevinbsmith@...>

> Is it possible for the US to develop corporate

36 messages 2000/12/11
[#7633] Re: Ruby in the US — Dave Thomas <Dave@...> 2000/12/19

tonys@myspleenklug.on.ca (tony summerfelt) writes:

[#7636] Re: Ruby in the US — "Joseph McDonald" <joe@...> 2000/12/19

[#7704] Re: Ruby in the US — Jilani Khaldi <jilanik@...> 2000/12/19

> > first candidates would be mysql and postgressql because source is

[#7705] Code sample for improvement — Stephen White <steve@...> 2000/12/19

During an idle chat with someone on IRC, they presented some fairly

[#7750] Re: Code sample for improvement — "Guy N. Hurst" <gnhurst@...> 2000/12/20

Stephen White wrote:

[#7751] Re: Code sample for improvement — David Alan Black <dblack@...> 2000/12/20

Hello --

[#7755] Re: Code sample for improvement — "Guy N. Hurst" <gnhurst@...> 2000/12/20

David Alan Black wrote:

[#7758] Re: Code sample for improvement — Stephen White <steve@...> 2000/12/20

On Wed, 20 Dec 2000, Guy N. Hurst wrote:

[#7759] Next amusing problem: talking integers (was Re: Code sample for improvement) — David Alan Black <dblack@...> 2000/12/20

On Wed, 20 Dec 2000, Stephen White wrote:

[#7212] New User Survey: we need your opinions — Dave Thomas <Dave@...>

16 messages 2000/12/14

[#7330] A Java Developer's Wish List for Ruby — "Richard A.Schulman" <RichardASchulman@...>

I see Ruby as having a very bright future as a language to

22 messages 2000/12/15

[#7354] Ruby performance question — Eric Crampton <EricCrampton@...>

I'm parsing simple text lines which look like this:

21 messages 2000/12/15
[#7361] Re: Ruby performance question — Dave Thomas <Dave@...> 2000/12/15

Eric Crampton <EricCrampton@worldnet.att.net> writes:

[#7367] Re: Ruby performance question — David Alan Black <dblack@...> 2000/12/16

On Sat, 16 Dec 2000, Dave Thomas wrote:

[#7371] Re: Ruby performance question — "Joseph McDonald" <joe@...> 2000/12/16

[#7366] GUIs for Rubies — "Conrad Schneiker" <schneik@...>

Thought I'd switch the subject line to the subject at hand.

22 messages 2000/12/16

[#7416] Re: Ruby IDE (again) — Kevin Smith <kevins14@...>

>> >> I would contribute to this project, if it

17 messages 2000/12/16
[#7422] Re: Ruby IDE (again) — Holden Glova <dsafari@...> 2000/12/16

-----BEGIN PGP SIGNED MESSAGE-----

[#7582] New to Ruby — takaoueda@...

I have just started learning Ruby with the book of Thomas and Hunt. The

24 messages 2000/12/18

[#7604] Any corrections for Programming Ruby — Dave Thomas <Dave@...>

12 messages 2000/12/18

[#7737] strange border-case Numeric errors — "Brian F. Feldman" <green@...>

I haven't had a good enough chance to familiarize myself with the code in

19 messages 2000/12/20

[#7801] Is Ruby part of any standard GNU Linux distributions? — "Pete McBreen, McBreen.Consulting" <mcbreenp@...>

Anybody know what it would take to get Ruby into the standard GNU Linux

15 messages 2000/12/20

[#7938] Re: defined? problem? — Kevin Smith <sent@...>

matz@zetabits.com (Yukihiro Matsumoto) wrote:

26 messages 2000/12/22
[#7943] Re: defined? problem? — Dave Thomas <Dave@...> 2000/12/22

Kevin Smith <sent@qualitycode.com> writes:

[#7950] Re: defined? problem? — Stephen White <steve@...> 2000/12/22

On Fri, 22 Dec 2000, Dave Thomas wrote:

[#7951] Re: defined? problem? — David Alan Black <dblack@...> 2000/12/22

On Fri, 22 Dec 2000, Stephen White wrote:

[#7954] Re: defined? problem? — Dave Thomas <Dave@...> 2000/12/22

David Alan Black <dblack@candle.superlink.net> writes:

[#7975] Re: defined? problem? — David Alan Black <dblack@...> 2000/12/22

Hello --

[#7971] Hash access method — Ted Meng <ted_meng@...>

Hi,

20 messages 2000/12/22

[#8030] Re: Basic hash question — ts <decoux@...>

>>>>> "B" == Ben Tilly <ben_tilly@hotmail.com> writes:

15 messages 2000/12/24
[#8033] Re: Basic hash question — "David A. Black" <dblack@...> 2000/12/24

On Sun, 24 Dec 2000, ts wrote:

[#8178] Inexplicable core dump — "Nathaniel Talbott" <ntalbott@...>

I have some code that looks like this:

12 messages 2000/12/28

[#8196] My first impression of Ruby. Lack of overloading? (long) — jmichel@... (Jean Michel)

Hello,

23 messages 2000/12/28

[#8198] Re: Ruby cron scheduler for NT available — "Conrad Schneiker" <schneik@...>

John Small wrote:

14 messages 2000/12/28

[#8287] Re: speedup of anagram finder — "SHULTZ,BARRY (HP-Israel,ex1)" <barry_shultz@...>

> -----Original Message-----

12 messages 2000/12/29

[ruby-talk:7042] Re: block syntax/def syntax question/suggestion

From: Clemens Hintze <c.hintze@...>
Date: 2000-12-11 12:10:02 UTC
List: ruby-talk #7042
>>>>> "Ben" == Ben Tilly <ben_tilly@hotmail.com> writes:

    Ben> Clemens Hintze <c.hintze@gmx.net> wrote:
    >>  >>>>> "Phil" == Phil Tomson <ptkwt@user2.teleport.com> writes:
    >> 
    Phil> Being very new to Ruby (2-3 days) and very familiar with
    >>  Then, may I welcome you here? We really appreciate everyone
    >> who wants to give it a try :-)

    Ben> I only wish the rest of your tone was as welcoming.

Ahh ... what? Do you think my tone was unpolite or rude??? Wow! How
have you got that impression?

(...)

    >>  And here is one BIG difference between Ruby and Perl. In Perl
    >> the { ... } are merely block delimiters. You are right! And so
    >> for Ruby's usage of { ... }.

    Ben> Merely?

Yes, merely! But see below, please ...

    Ben> The rest of my reply will have an annoyed tone BECAUSE YOU
    Ben> ARE YELLING ABOUT SOMETHING YOU CLEARLY KNOW NOTHING ABOUT
    Ben> without having any CAUSE to yell.

What??? Yelling??? Now you do astonish me! How got you that
impression? Is it because I use upcase letters to emphase (catch eye)
some words?  I do that regulary, sometimes I use also convention like
*that* or _this_. IIRC, nobody has ever accused me to yelling by doing
so (not that this counts anyhow, as my memory is very short timed ;-)

In regulary documents, I would use kursive or bold font. What should I
use in ASCII documents to {\em not} offend peoples like you?

Anyway, I beg pardon for giving you the impression of yelling!

But why do you think, that I (...)CLEARLY KNOW NOTHING ABOUT(...), is
beyond my horizon. Perhaps I have explained it from another point of
view? Perhaps from a more abstract view, dismissing all internals how
it is iplemented? Had you taken these into account before accusing me?
If not, then, sorry to say that, I found your tone a bit rude!

However, if you had taken into account those, why are you still
thinking that I do know nothing about it?

    Ben> Is it really such a hard rule to be sure you know what you
    Ben> are talking about before you yell?

I thought I am sure. But perhaps you have misunderstood me?

    >> BUT in Ruby a block (let me call it R-BLOCK) is a TOTALLY
    >> DIFFERENT thing as a block in Perl (P-BLOCK). A P-BLOCK only
    >> groups statements in the source and is only used via
    >> compilation stage to determine such groups of statements!

    Ben> It is not obvious to the casual scripter, but a block in Perl
    Ben> is a lot more than just a group of statements.

Not if I view and explain it from an very abstract point of view! I
know that in Perl every thing is an object; but not in an OOP sense. I
know that block are complex internally. But I believe to express the
difference in Ruby and Perl it would not be necessary to go into
internals. 

    >> R-BLOCKs, however, constitutes REAL OBJECTS that happen to
    >> CONTAIN code. Only the R-BLOCKs objects are not DIRECTLY
    >> accessible like any other object. You may access them via:

    Ben> WHY ARE YOU YELLING?

I AM NOT YELLING! Sorry I couldn't resist ;-)

    Ben> They are not directly accessible in Perl either.  But they
    Ben> are real internal things.  There are rather fewer obvious
    Ben> hooks, but what do you think a scope is attached to?  At the
    Ben> end of a block is when garbage collecting etc takes place.
    Ben> Blocks are what you hang lexical variables off of.  If you
    Ben> start generating closures in Perl, you start producing new
    Ben> blocks.  And conversely the continued existence of a block is
    Ben> necessary for closures to work properly, each variable knows
    Ben> which copy of the block it is associated with.

I know this. But from my explanation POV, I thought it was not
necessary to go so far. In C/C++ blocks are also created via {
... }. They also can own automatic variables with a certain scope. But
there, they are not complex objects like in Perl. But from the
programmer's POV they looks and feel like Perl ones. That was what I
tried to explain.

    Ben> As a result, far from just being a group of statements, a
    Ben> block in Perl has a considerable internal structure.  In fact
    Ben> there is real overhead both entering and leaving a block
    Ben> because of everything that goes on then.

I know; again: It was an abstraction and simplification. As I cannot
access blocks from a Perl program, I see them as C/C++ like
blocks. But I know they are not equal.

    >> yield : Calling an associated block block_given? : Check if an
    >> block is associated proc | lambda | Proc.new : Convert a block
    >> to a Proc instance &var : - In formal parameter list, convert
    >> attached block to a Proc instance and pass that to 'var' - In
    >> an actual parameter list, converts a Proc instance back to a
    >> R-BLOCK object.

    Ben> The internal organization of Perl exposes no equivalent to
    Ben> that That doesn't mean that the internal organization of a
    Ben> block in Perl isn't a fairly complex thing.

That was not what I had intend. Only to explain the difference. Ruby
blocks may be accessed/converted via Ruby commands; so that makes them
{\em objects} for me. Perl ones couldn't, that makes them more like
C/C++ blocks for me.

I know in reality this is not true. I also believe that the internal
realization of ruby blocks and perl blocks is not too different. But
I thing that most often it is a good thing to avoid such internals if
your goal is only to explain simple behavior. But perhaps my way is
not your way of explaning things. But I hope that group is large
enough for our both ways of explanation. :-)

    Ben> (There has been discussion in Perl of adding continuations.
    Ben> But a couple of key people (eg Mark Dominus) don't want it
    Ben> for various internal reasons.)

    >> Whereby a Proc instance is something similar to Perl's sub
    >> reference:
    >> 
    >> sub { ... };
    >> 
    >> To stress it again, that do ... end and { ... } constitutes
    >> REAL objects, that can be dealt with.
    >> 
    >> Statements like 'def', 'if', 'for', etc. that need only
    >> statement grouping, but not no R-BLOCK objects, will have the
    >> different syntax/convention, that the statement opens the
    >> grouping and a corresponding 'end' will close it.

    Ben> You have not actually explained why all of this extra
    Ben> behaviour cannot exist but not be accessible.  Or why similar

Because, perhaps, as blocks in Ruby opens new scope as in Perl, but it
does not in statement like: 'if', 'while', ...

Of course you could have blocks behaving different if used for a 'if'
than used otherwise. But that would make the handling inconsistent,
IMHO. 

    Ben> syntax in different places cannot wind up being internally
    Ben> being represented differently.  In fact Ruby already does
    Ben> that.  Syntactically what is the difference between a block
    Ben> and a hash?

Caught me! Of course your could do this. But that would makes it even
more difficult to parse things like that:

  if func { ... }

Would func getting { ... } as argument, or is { ... } the then-block
of the 'if' statement. You could solve that, but I think it is not
worth the trouble. Especially, as I already mentioned, you then-block
shall not open a new scope in opposition what every Ruby block do!

Or if you do this:

  if func { ... } {
    ...
  } else {
    ...
  }

looks pretty ugly, IMHO!

    >> You see, no easy way to get Perl's or C/C++'s behavior here!

    Ben> No, your explanation doesn't explain that for me.  It *DID*
    Ben> tell me that you are willing to pontificate about Perl
    Ben> without really understanding it, but failed to convince.

It may be that it failed to convince you! My fault then. But please do
not accuse me to something I have not intent.

    Ben> Now as it happens, even being pretty unfamiliar with the
    Ben> language, I can come up with a very good reason why Ruby
    Ben> would not want to match Perl's behaviour.  Here it is.

(... really good explanation snipped ...)

    Ben> Was that so hard?  A simple explanation delivered without
    Ben> having to go out on a limb about how the internals of other
    Ben> languages work, and without any need to yell.

I have never told anything of the internals of other languages or Ruby
in my Mail. Right opposite to that! I have tried to avoid internals
and show it from a abstract and simplified POV.

It was {\em you} that has assumed and accused me to do this!

    >> I hope you will anyway find fun with Ruby :-)

    Ben> Seeing you YELL incorrect stuff about other languages in
    Ben> response to a reasonable question does take the blush
    Ben> off. :-(

I hope that my explanation makes clear what I had intent with my
explanation. Except the yelling thingy -- that I didn't know its
offending potential -- I think I have not doing anything wrong. I
really hope you will understand my intention correclty after my
explanation.

Let us try to stay in peace here. There should be enough place for us
both!

> Sincerely, Ben

Best regards,
\cle

In This Thread

Prev Next