[#98950] Strange behaviour of Strings in Range — Michael Neumann <mneumann@...>

Hi,

24 messages 2004/05/01

[#98975] Why no Proc##[]=() ? Why no Proc##replace() ? — Jean-Hugues ROBERT <jean_hugues_robert@...>

Hi,

15 messages 2004/05/01
[#98983] Re: Why no Proc##[]=() ? Why no Proc##replace() ? — Dan Doel <djd15@...> 2004/05/01

I'm not sure what your proposal means.

[#98997] Re: Why no Proc##[]=() ? Why no Proc##replace() ? — Jean-Hugues ROBERT <jean_hugues_robert@...> 2004/05/02

About class Proc; def []=(*args); self[*args] end end and the value of

[#98980] Ruby Newbie (ooh, that rhymes!) - When do I use do/end, when {}? — glenn_m_smith@... (Glenn)

Hello all

23 messages 2004/05/01

[#99105] What do you use Ruby for? — glenn_m_smith@... (Glenn)

OK, the more I read about Ruby (currently on page 29 of the FAQ,

25 messages 2004/05/03

[#99119] YAML vs. Marshal — dejaspam@... (Bill Atkins)

Is there any reason to use Marshal instead of YAML? Is there anything

21 messages 2004/05/03
[#99121] Re: YAML vs. Marshal — Joel VanderWerf <vjoel@...> 2004/05/03

Bill Atkins wrote:

[#99191] Re: YAML vs. Marshal — why the lucky stiff <ruby-talk@...> 2004/05/04

Joel VanderWerf wrote:

[#99192] Re: YAML vs. Marshal — Hal Fulton <hal9000@...> 2004/05/04

why the lucky stiff wrote:

[#99204] What so special about PostgreSQL and other RDBMS? — "Sarah Tanembaum" <sarah.tanembaum@...>

Beside its an opensource and supported by community, what's the fundamental

96 messages 2004/05/04

[#99270] Is Ruby Top 1 of Programming Languages that are Loved? — "Park Heesob" <phasis68@...>

Hi all,

66 messages 2004/05/05
[#99333] Re: [OT]Is Ruby Top 1 of Programming Languages that are Loved? — ptkwt@... (Phil Tomson) 2004/05/06

In article <83173408.0405051506.5db85fe6@posting.google.com>,

[#99358] Re: [OT]Is Ruby Top 1 of Programming Languages that are Loved? — Dick Davies <rasputnik@...> 2004/05/06

* Phil Tomson <ptkwt@aracnet.com> [0554 02:54]:

[#99378] Re: [OT]Is Ruby Top 1 of Programming Languages that are Loved? — "Ara.T.Howard" <ahoward@...> 2004/05/06

On Thu, 6 May 2004, Dick Davies wrote:

[#99326] RAA error - can't dup NilClass — Simon Strandgaard <neoneye@...>

When I try to enter my project page

15 messages 2004/05/06
[#99327] Re: RAA error - can't dup NilClass — "NAKAMURA, Hiroshi" <nahi@...> 2004/05/06

Hi,

[#99328] Re: RAA error - can't dup NilClass — "NAKAMURA, Hiroshi" <nahi@...> 2004/05/06

Hi, again,

[#99332] miniruby.exe & statically linked ruby.exe (Windows) — ptkwt@... (Phil Tomson)

I've been trying to build a statically linked ruby.exe on windows using

12 messages 2004/05/06

[#99399] DRb Connection Closed Error?!?!?!? — "Ken Hilton" <kenosis@...>

Greetings,

14 messages 2004/05/06

[#99438] What is Borges? — dejaspam@... (Bill Atkins)

Can someone please explain to me what Borges does? Its home page

41 messages 2004/05/07
[#99482] Re: What is Borges? — Dick Davies <rasputnik@...> 2004/05/07

* Bill Atkins <dejaspam@batkins.com> [0534 01:34]:

[#99530] Re: What is Borges? — Julian Fitzell <julian@...4.com> 2004/05/07

Dick Davies wrote:

[#99534] Re: What is Borges? — Carl Youngblood <carl@...> 2004/05/07

[#99527] Ruby Installer for Windows: use of Win32OLE bug causes crash — Jos Backus <jos@...>

This is with the latest Ruby Installer for Windows, 181-13-rc2.

11 messages 2004/05/07

[#99583] Ruby Installer for Windows 1.8.1-13 final — "Curt Hibbs" <curt@...>

The Ruby Installer 1.8.1-13 (final) for Windows has been released and

62 messages 2004/05/08
[#99643] Why Ruby? -- A Resource for Promoting Ruby — "Curt Hibbs" <curt@...> 2004/05/09

I'm pleased to announce the kickoff of RubyForge project called "Why Ruby?"

[#104934] Ruby Installer for Windows 1.8.2-14 Release Candidate — "Curt Hibbs" <curt@...> 2004/06/30

I have uploaded a release candidate for Ruby Installer that was built using

[#104952] **RC2** Ruby Installer for Windows 1.8.2-14 Release Candidate — "Curt Hibbs" <curt@...> 2004/07/01

The original release candidate that I posted earlier today did not include

[#105519] Re: [ANN] **RC2** Ruby Installer for Windows 1.8.2-14 Release Candidate — Lothar Scholz <mailinglists@...> 2004/07/07

Hello Curt,

[#105546] Re: [ANN] **RC2** Ruby Installer for Windows 1.8.2-14 Release Candidate — Hidetoshi NAGAI <nagai@...> 2004/07/08

Hi,

[#105550] Re: [ANN] **RC2** Ruby Installer for Windows 1.8.2-14 Release Candidate — nobu.nokada@... 2004/07/08

Hi,

[#99597] How to get the last 5 elements of an array? — Gavin Sinclair <gsinclair@...>

Hi,

20 messages 2004/05/08

[#99680] rubygarden homepage hacks — Simon Strandgaard <neoneye@...>

On daily basis the homepage at rubygarden is being edited.

19 messages 2004/05/09

[#99734] in search of a compelling reason to use ruby.... — Ryan Paul <segphault@...>

i'm a python programmer, and I have recently been hearing a lot about

28 messages 2004/05/10

[#99764] safe eval? — "Ara.T.Howard" <Ara.T.Howard@...>

20 messages 2004/05/10
[#99773] Re: safe eval? — Florian Gross <flgr@...> 2004/05/10

Ara.T.Howard wrote:

[#99834] Re: safe eval? — ts <decoux@...> 2004/05/11

>>>>> "F" == Florian Gross <flgr@ccan.de> writes:

[#99854] Proposal: Object#send(nil) -> self — Gavin Sinclair <gsinclair@...>

A quick one. I see some sense in Object#send accepting 'nil' as the

21 messages 2004/05/11

[#99879] Strange regexp behaviour in gsub — Kristof Bastiaensen <kristof@...>

Hi,

15 messages 2004/05/11

[#99945] Recommendations (Ruby making my head swim) — Mike Rhodes <rhodes553@...>

I recently bought "Programming Ruby" and set out to learn the language

13 messages 2004/05/12

[#99966] Major Addition Bug? — "Sean O'Dell" <sean@...>

Doing this:

57 messages 2004/05/12
[#99967] Re: Major Addition Bug? — ts <decoux@...> 2004/05/12

>>>>> "S" == Sean O'Dell <sean@celsoft.com> writes:

[#99970] Re: Major Addition Bug? — "Sean O'Dell" <sean@...> 2004/05/12

On Wednesday 12 May 2004 09:53, ts wrote:

[#100032] are there any ruby IDEs? — Ryan Paul <segphault@...>

I use vim most of the time, but i'm curious if there are any

35 messages 2004/05/12

[#100093] How to make combinations of an array to produce all possible expressions? — Erik Terpstra <erik@...>

I have an array 'conds', which contains some sub-expressions for an

11 messages 2004/05/13

[#100136] Ruby's Best -- Please Help — "Curt Hibbs" <curt@...>

On the "Why Ruby?" project wiki (http://whyruby.rubyforge.org/), I am trying

23 messages 2004/05/13
[#100284] Please revisit Ruby's Best and vote for additions — "Curt Hibbs" <curt@...> 2004/05/14

If you were an early visitor to:

[#100137] First Presentation Posted to Why Ruby! — "Curt Hibbs" <curt@...>

Assaph Mehr just posted the first presentation to Why Ruby

22 messages 2004/05/13
[#100172] Presenting a more unified front (Ruby webring?) — ptkwt@... (Phil Tomson) 2004/05/13

In article <EAENKKNOJPMNCDMLDOMLKEHHEFAA.curt@hibbs.com>,

[#100182] C++ Exception compatibility idea — Asfand Yar Qazi <im_not_giving_it_here@..._hate_spam.com>

Hi,

26 messages 2004/05/13
[#100206] Rite implementation in C++? (Objective C?) — ptkwt@... (Phil Tomson) 2004/05/13

In article <40A3E539.2010204@hypermetrics.com>,

[#100193] subclasses of string as hash keys — Matthias Georgi <matti_g@...>

15 messages 2004/05/13

[#100273] Regexp Error? — "Robert Klemme" <bob.news@...>

What's wrong here?

16 messages 2004/05/14

[#100295] Re: Regexp Error? — Michael Campbell <michael_s_campbell@...>

ts wrote:

15 messages 2004/05/14

[#100325] Re: Please revisit Ruby's Best and vote for additions — "Curt Hibbs" <curt@...>

James Britt wrote:

12 messages 2004/05/14

[#100395] Need Help Selecting a GUI — dejaspam@... (Bill Atkins)

As anyone can tell by looking at the topics of my recent posts, I'm

18 messages 2004/05/15

[#100461] Ruby on Rails — Matt Lawrence <matt@...>

Very neat presentation, it kept me up way too late last night watching it.

24 messages 2004/05/16

[#100511] How to duck type? - the psychology of static typing in Ruby — Tim Bates <tim@...>

Hi all,

83 messages 2004/05/17
[#100525] Re: How to duck type? - the psychology of static typing in Ruby — "SER" <ser@...> 2004/05/17

Broken record time:

[#100791] Re: How to duck type? - the psychology of static typing in Ruby — Marek Janukowicz <childNOSPAM@...17.ds.pwr.wroc.pl> 2004/05/19

On Thu, 20 May 2004 03:43:22 +0900, Dave Thomas wrote:

[#100613] FoX: removing widgets — Yuri Leikind <y.leikind@...>

Hello all,

16 messages 2004/05/18
[#100670] Re: FoX: removing widgets — Lyle Johnson <lyle@...> 2004/05/18

Yuri Leikind wrote:

[#100629] Newbie installation problem: libraries? — Paul Emmons <pemmons@...>

I have recently installed ruby-1.8.1 on my Mandrake Linux system.

11 messages 2004/05/18

[#100649] Windows desktop app w/ simple db; how? — "Kirk Haines" <khaines@...>

Imagine that you had a very simple web based application. It queries some

12 messages 2004/05/18

[#100653] Zero is true ... whoda thunk? — "Richard Lionheart" <NoOne@...>

Hi,

29 messages 2004/05/18
[#100655] Re: Zero is true ... whoda thunk? — Mark Sparshatt <msparshatt@...> 2004/05/18

Richard Lionheart wrote:

[#100682] Re: Zero is true ... whoda thunk? — Chris Pine <cpine@...> 2004/05/19

On Wed, 19 May 2004 06:34:54 +0900, Mark Sparshatt wrote:

[#100691] Re: Zero is true ... whoda thunk? — David Naseby <david.naseby@...>

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

14 messages 2004/05/19

[#100721] irb or xterm crash with UTF-8 — Simon Strandgaard <neoneye@...>

server> irb

15 messages 2004/05/19

[#100839] Where to download FXRuby library; where to put it; RUBYLIB, RUBYPATH env. vars — "Richard Lionheart" <NoOne@...>

Hi,

14 messages 2004/05/20

[#100862] Ruby's builtin Datastructures — Brian Schroeder <spam0504@...>

Hello all,

13 messages 2004/05/20

[#101071] Concerning version numbers... — Hal Fulton <hal9000@...>

A few people in recent weeks have been bemoaning the fact that software

15 messages 2004/05/22

[#101110] Ruby for educational purposes and localization — Laurent Julliard <laurent__no__@__spam__moldus.org>

All,

10 messages 2004/05/23

[#101165] make faster Richards benchmark — dlissett0@... (Duncan Lissett)

I'd appreciate any suggestions on how to make a faster Ruby

15 messages 2004/05/24

[#101226] Concerning package names — djberg96@... (Daniel Berger)

All,

13 messages 2004/05/24

[#101292] Numeric#of — "Ara.T.Howard" <ahoward@...>

53 messages 2004/05/25

[#101329] separating ruby-talk from comp.lang.ruby? — David Alan Black <dblack@...>

Hi --

65 messages 2004/05/25
[#101388] Re: separating ruby-talk from comp.lang.ruby? — ptkwt@... (Phil Tomson) 2004/05/25

In article <m3brkcda7g.fsf@wobblini.net>,

[#101391] Re: separating ruby-talk from comp.lang.ruby? — "David A. Black" <dblack@...> 2004/05/25

Hi --

[#101360] ruby-dev summary 23459-23562 — Minero Aoki <aamine@...>

Hi all,

30 messages 2004/05/25
[#101395] Re: ruby-dev summary 23459-23562 — Florian Gross <flgr@...> 2004/05/25

Minero Aoki wrote:

[#101369] defining condititions — Florian Weber <csshsh@...>

hi!

18 messages 2004/05/25

[#101522] WEBrick and FastCGI response — Jim Freeze <jim@...>

Reply-To:

15 messages 2004/05/27

[#101560] Re: separating ruby-talk from comp.lang.ruby? — "Mills Thomas (app1tam)" <app1tam@...>

Here, here, hear, hear. No NNTP here.

41 messages 2004/05/27
[#101565] Re: separating ruby-talk from comp.lang.ruby? — "David A. Black" <dblack@...> 2004/05/27

Hi --

[#101569] Re: separating ruby-talk from comp.lang.ruby? — Dave Thomas <dave@...> 2004/05/27

[#101571] Re: separating ruby-talk from comp.lang.ruby? — "David A. Black" <dblack@...> 2004/05/27

Hi --

[#101616] Re: separating ruby-talk from comp.lang.ruby? — "David A. Black" <dblack@...> 2004/05/28

Hi --

[#101686] Re: separating ruby-talk from comp.lang.ruby? — Dave Thomas <dave@...> 2004/05/28

[#101890] Re: separating ruby-talk from comp.lang.ruby? — "David A. Black" <dblack@...> 2004/05/31

Sorry everyone, testing again.... small meaningless tweak to

[#101674] Andreas' practical language comparison — "Georgy" <no.mail@...>

Hi all!

13 messages 2004/05/28

[#101745] Test::Unit: assert_follows_spec() (or something like that) — David Garamond <lists@...6.isreserved.com>

For deterministic functions/methods, the same set of inputs should

20 messages 2004/05/29

[#101823] gsub!, replace with \' — Patrick Gundlach <clr1.10.randomuser@...>

Dear Ruby-hackers,

14 messages 2004/05/30

[#101830] Behavior of application changes when adding non-relevant puts — felix.nawothnig@... (Felix Nawothnig)

Hi.

12 messages 2004/05/30

[#101853] mysql-ruby — Paul Vudmaska <paul@...>

%$@#%$ i know i've abused this list with more questions than answers but

14 messages 2004/05/31

[#101855] elegant way to say "try this thing, one at a time, until condition is met" — David Garamond <lists@...6.isreserved.com>

Example: I need to unmount /usr and /usr2, but currently I can't because

23 messages 2004/05/31

[#101899] RMagick available on Windows — Tim Hunter <cyclists@...>

Thanks to Kaspar Schiess, RMagick for Windows is now available at

13 messages 2004/05/31

Re: Why no Proc##[]=() ? Why no Proc##replace() ?

From: Jean-Hugues ROBERT <jean_hugues_robert@...>
Date: 2004-05-05 13:20:15 UTC
List: ruby-talk #99275
At 09:16 05/05/2004 +0900, you wrote:
> > >   a[i, j, k] = l, m, n  #=> becomes a.call(i, j, k, [l, m, n])
> > Its actually # => becomes a.call( i, j, k, l).
>:) No, it does what I said. Try it out.

You are right, I was wrong.
Fortunately a[i, j, k], b = l, m, n *does* become
a.call( i, j, k, l) plus b = m.

I was worried that multiple assignments would not work specifically
with []=, but it does work, as long as both sides of = are "multiple".

> > We both agree I think that o.x = y is a nicer syntax then o.x( y).
> > Only I think that p[] = y is a nicer syntax then p[y] if proc were an
> > accessor.
>
>But p isn't always an accessor.  Your #[]= proposal is similar to saying
>that because we can call p.a, we should always be able to call p.a = b.

The thing is, the one that use a block usually knows about what the
block semantic is and what is the protocol to use it (including what params the
block expects). My proposal is just a convenience thing so that
you can keep doing x = proc { xxx } instead of some x = LvalueProc.new { xxx },
when your proc can be a lvalue in addition to a rvalue. Not a big deal really.

> > Back to block: b[] = x, to me, reads as "the content of b is assigned the
> > value of x".
> > What that means exactly depends on the semantic of the block b.
>
>But b[] isn't "the content of b" for Proc objects. It's "call b."  They're
>different conventions.

That is the way it is today, I am proposing a small change where in addition
to [] meaning "value of" or "call" there would be []= meaning "gets 
assigned xx".
This would be an additional convention/meaning that the user may want to attach
to the semantic of the block. It would not work for read only block,
much like Konst = x does not work for constants. I understand that you
prefer []= to be undefined by Proc because there are blocks which are
read-only and as a result []= is meaningless for them whereas [] allways make
sense because a block is always "callable", if you know what parameter to use.
At the end of the day it the user of the block that knows what can be done,
not class Proc. I suppose we may safely assume that []= makes no sense, never,
with parameterless blocks.

>In C++, I can do
>   cout << "Hello.";
><< also works on ints.  Does this make sense?
>   a = 5 << "Hello";
>Just because it's the same symbols (<< or []) doesn't mean it does the same
>thing.  [] for Array means something different than [] for Proc.  It's handy
>that they can be used interchangably in some circumstances, but that doesn't
>mean they're interchangeable in all circumstances.

Sure. In some circumstances I do believe it is "handy" that a Proc could 
implement
slightly more of the protocol of Array. That is possible by some user defined
ArrayLikeProc subclass of Proc. That class Proc would implement []= would just
be convenient, a convenience that is questionable and is maybe a matter of
taste.

>Just because Arrays have
>[] doesn't mean I expect them to define #call like a Proc.  So just because
>Procs have [] doesn't mean they should have []= like an array.

Symmetry for symmetry is not a good enough reason, I agree with you.

On a similar plane but for rvalue, I think Smalltalk as a xx.value() method 
that
a lot of objects implement. Such objects are called Valueables I think.
This is handy. I think Smalltalk .value() for blocks/procs would be 
equivalent to
xx.call().

About an hypothetical Lvalue class:
c = Foo.new()
> > If c is_a? Lvalue then the lvalue object that c refers to (& which can be
> > any lvalue,
> > a variable included), becomes a new Foo (which means that it now refers to
> > a Foo:
> > c now refers to the same something but that something now refers to the new
> > Foo).
>
>So the interpreter has to do runtime checks to see if a variable has an object
>of type Lvalue and then does special things if it is? What if I want to make
>my own class that has special assignment characteristics, but don't want to
>inherit from Lvalue? I can't.

How the interpretor determines that an object references another one
is to be refined. Obviously a Lvalue object would reference another object.
As a result the Interpretor could handle assignment doing something like:
if (target_var = exiting_var).kind_of? Lvalue then
   target_var = existing_var_current_value
end
assign new_value to target_var

OTOH the interpretor could use .respond_to? := instead of .kind_of? Lvalue.

In the first case, you are right, if you want to make your own class that
has special assignment characteristics, you have to inherit from Lvalue.

In the second case you merely have to define .=() in your own class.

It is probable that there are other ways for the interpretor to determine
that it has to do an additional level of dereferencing. Each way would have
pros/cons. I would tend to pick a solution with minimal speed overhead because
the check would occur frequently.

Please note that I believe that a Lvalue class would be usefull even
without any auto-dereferencing by the interpretor. Auto dereferencing is
just something that would make my prototype implementation of LogicPointer
more transparent (much as can be done with delegation on some other plane).

> > However, this does not mean that all Ruby variables would have to be
> > different from what they are today (whatever the name you use to describe
> > what they are today). Only variables that holds a reference to a Lvalue
> > object would have to be treated differently than the "normal" variables.
> > That's because the Ruby interpretor would have to invoke some .getter() or
> > .setter() method of the Lvalue instead of using the variable's content
> > directly (or, to rephrase more formally, xxx instead of directly using the
> > reference to some object that the variable holds).
>
>How do you determine at compile time whether
>
>   a = b
>
>means "a = b" or "a.setter(b.getter)"?  The only answer I can see is, "it's
>always 'a.=(b)'."  Which means by-value assignment.  The only way you could
>keep Ruby's existing assignment semantics, is if 'a.=(b)' was by default
>'a.become(b)'.

I think that you are right, you cannot determine it easely at compile time.
I believe you should to do it at runtime.

But the interpretor can optimize that a lot because most of the time the 
full blown
Lvalue object is not needed by the user.

> > I am not proposing such a radical change at all. I would rather go forward
> > than backward :-) What I am proposing is an additional tool, by the way of
> > an additional level of indirection. When the programmer need that tool it
> > has to be explicit and she/he would create a Lvalue object using some
> > explicit syntax:
> > b = "toto"
> > c = ref b # *explicit*
> > c = "titi"
> > p b # => "titi"
> > c is like an alias for b.
>
>So is c a different type of variable than b?  Does this mean we have regular
>type variables and reference type variables?

Not exactly. What happens is that a variable can reference a Lvalue object.
When assigning a value to a variable, the interpretor would check the previous
value of the variable. If the variable references an Lvalue object (or, maybe,
an object that responds to := ) then it would be the Lvalue object that is 
told to
reference a new value instead of the initial variable.

>   Are reference type variables
>only able to have their references set at time of definition?  How does this
>work:
>
>   a = "toto"
>   b = "frodo"
>   c = ref b
>   c = ref a
>
>At the end, what is b?  Is b a reference to a? Is b still "frodo"?  If you
>pick one, what if I want the other?  Also, what about:
>
>   a = "toto"
>   c = "frodo"
>   c = ref a
>
>How does the compiler know which type of variable c is, because it holds both
>regular and reference types at various times?

Very good questions indeed.

I believe that
   c = ref b
   c = ref a
implies that at the end b is a Lvalue that references the variable a (and
c stays unchanged)

If you want the other you need to use the RCR's "assign" operator:
assign c, ref a.

That will be described further in the "match, assign & Lvalue" RCR that
I am working on.

>Here's what I'm saying. By distinguishing between regular and reference
>variables or whatever, what you're saying is that "A variable represents a
>chunk of memory."  Currently, Ruby says, "A variable is a reference to an
>object."  For your proposal to work, 'a = b' for reference variables would
>mean, "copy b's memory into the place pointed by a."  Currently, it's
>"make a point to the same place as b."  In your proposal, 'a = b' for regular
>variables (and there is a distinction) would mean "copy b's memory into
>a's memory."

I was not clear enough in my explanations. Thanks to the Lvalue class, a 
variable
can sometimes reference another variable. At the end of the day *all* variables
reference an object, exactly as it is the case with Ruby today.

There would be no such thing as a "regular" versus a "reference" variable.
There would be only "regular" variables, but some of them would reference
an object of class Lvalue instead of an object of some other class.

>I guess what you want is to keep "every variable is a reference" and you
>want reference references.  Or something like that.  You've already built
>that with your pointer class, it just isn't as transparent as regular
>assignment.  But in my mind, that's okay, because what you want isn't
>useful/the correct way to do things very often.  If we had what you
>envision, we could have people writing:
>
>   foo(a, ref b)
>
>instead of
>
>   b = foo(a)
>
>Which is bad. It's like C.  The only reason you write C code like that is
>to return error codes while still passing out information, or to pass out
>multiple values.  We have exceptions for error conditions, and we can
>easily return out multiple values.  So variable references are, in fact,
>_the incorrect Ruby-way to do things_ for the two biggest cases of their use
>in C.

I understand that any features can be poorly used. That something can be
used in a bad way is also the responsibility of the user (assuming that the
intended "good" usage was properly documented). I believe that a Lvalue class
is actually something that makes it possible to do things in a cleaner object
oriented way than what you can do today with more questionable mechanisms,
eval() included. It may also be a tool that makes it easy to do things that
are really difficult to do in Ruby.

The Lvalue class is to lvalues what the Method class is to methods.

Think about Ruby's local_variables(), it returns an array of strings. Then
you typically use the strings with eval(). A Lvalue class is kind of
implemented there, with strings object ids in some parallel object space.

Imagine now a local_variables() that would return an array of Lvalue
instances. Now, instead of using eval() to get/set the local variables, you
would use the Lvalue objects' getter()/setter() methods.

I think most people would agree that you should use eval() only when
there is no better way to do something (when there is no better way,
you are really happy that at least eval() does exist !).

A Lvalue class is I believe something useful to do things that can
be done with eval() only, as of today. It helps make these things
in a more object oriented way. I suspect it makes it possible to
do things that are really difficult to do today (never say
"impossible").

I hope it is clearer now that my intention is to help people do things
in a cleaner object oriented way. I don't feel responsible for the
perverse use of some new Lvalue class as long as my mechanism is
well designed enough to work well for natural "good" usages.

> > Then you don't mind that much that "In Ruby everything is an object, but
> > variables and
> > ... and ...".
> > I would prefer "In Ruby everything is an object". Introspection is a great
> > tool, the more, the better.
>
>To me, variables in Ruby are imaginary.  They only help me, and don't exist
>as far as the objects/interpreter are concerned.  The only way to get an
>object is by it's object id, and a variable holds an id for my convenience.

This is most often the case. It is only when you start toying with 
introspection
and meta-programming that the Lvalue class starts becoming interesting.

>I doubt reference variables would be used for introspection.  You can already
>get and set instance variables by a method.  What is the purpose of knowing
>that a method has a local variable called "x"?  Being able to assign to a
>variable in one place and have it affect a variable in an entirely different
>would, in my opinion, be more often confusing than useful.  Your logic
>methods are the only good example I know of, and you can implement them
>in pure Ruby as long as you don't mind using explicit dereferencing and some
>eval evil.  I don't think they would be generally useful, because there are
>better ways to do most of what they let you accomplish.

Thanks about the "logic" methods. The prototype implementation is in progress,
using explicit dereferencing (and some eval evil). How much useful it is
may become more apparent in the future RCR unless I am overlooking better
ways to do most of waht they let you accomplish.

I suppose my intention has some connections with yours regarding evil eval.
We both look for better ways to do things that only eval can do today.
Now, about how much introspection is enough, it varies depending on your needs.

>Cheers.
>
>- Dan

Thanks for your feedbacks.

Yours,

Jean-Hugues



-------------------------------------------------------------------------
Web:  http://hdl.handle.net/1030.37/1.1
Phone: +33 (0) 4 92 27 74 17  


In This Thread

Prev Next