[#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: Lazy evaluation

From: Jean-Hugues ROBERT <jean_hugues_robert@...>
Date: 2004-05-01 08:36:06 UTC
List: ruby-talk #98914
At 06:47 01/05/2004 +0900, you wrote:
>On Sat, May 01, 2004 at 05:38:03AM +0900, Jean-Hugues ROBERT wrote:
> > At 03:45 01/05/2004 +0900, you wrote:
> > >Hi,
> > >
> > >I am currently hacking a Packrat parser just for fun. I need to mix
> > >values (like numbers, strings etc.) together with lazy values. I want to
> > >make processing these values as transparent as possible.
> > > [...]
> > >Any comments or suggestions?
> > >
> > >Regards,
> > >
> > >  Michael
> >
> > Comments ? Not much. Besides the fact that we both need some kind of a
> > Reference class to inherit from.
> >
> > You to do:
> > class LazyValue < Reference
> > ...
> >
> > Me to do:
> > class LogicVariable < Reference
> >
> > In both cases we want automatic dereferencing of the object when its
> > value is required.
>
>Something like the Delegator class in delegate.rb is useful.
>I wrote my own lazy version:
>
>   class Lazy
>     self.methods.reject{|m| m =~ /^__(.*)__$/}.each {|m|
>       eval "def #{m}(*args, &block) __getobj__.send(:'#{m}', *args, 
> &block) end"
>     }
>
>     def initialize(*args, &block)
>       raise "no block given" if block.nil?
>       @args, @block = args, block
>     end
>
>     def __getobj__
>       if @block
>         @value = @block.call(*@args)
>         @block = @args = nil
>       end
>       return @value
>     end
>
>     def marshal_dump
>       __getobj__
>     end
>
>     def marshal_load(obj)
>       @value = obj
>     end
>
>     def method_missing(id, *args, &block)
>       __getobj__.send(id, *args, &block)
>     end
>   end

If this is not transparent, this is very close to transparent !

If I understand the code correctly, an instance of class Lazy delegates
to self.__getobj__() everything. I guess that besides the fact the only the 
Lazy
object itself implements :__getobj__, the key difference is the fact that
the object ids are different, but you can't tell because object_id() gets
delegated too (however __id__() can tell and __send__() is still there for
whatever reason I need to figure out).

This for sure works for Lazy, Future (Promise in some languages, Defered
in some others) and any other read-only cases. This is the rvalue case.

The lvalue case is another beast:
   def meth( x ) x = [x, "world"] end
   r = Refererence.new
   r = "Hello"
   meth( r, "World")
   p r # => Should be ["Hello", World]

Once solved I will be able to implement LogicVariable:
   v = LogicVariable.new
   v = free
   p match [[["x"]]], [[[v]]] # True
   p v # => "x", changed as a side effect of match
   v = "y"
   p match [[["x"]]], [[[v]]] # False, "x" != "y"
   p v # => "y", unchanged

As a reminder: I need LogicVariable to prototype a new "match" builtin
and its "assign" variation in an RCR. "assign" does what Ruby does
today in multiple assignments and when it assigns actual parameters
to formal ones (for method calls and proc calls), and more. "match"
does both assignment and comparison (when previous value already bound)

So far I implemented:
   v = LogicPointer.new
   v.free!
   p match [[["x"]]], [[[v]]] # True
   p v[] # => "x"
   v[] = "y"
   p match [[["x"]]], [[[v]]] # False
   p v[] # => "y"
Which is close, besides the additional []

Thanks to your code, I think I will be able to:
   v = LogicDelegator.new
   v.free!
   p match [[["x"]]], [[[v]]] # True
   p v[] # => "x"
   v[] = "y"
   p match [[["x"]]], [[[v]]] # False
   p v # => "y", note the absence of []
Which is one step in the good direction. Thanks.

>And to replace all Lazy objects with their values, I can now use
>obj = Marshal.load(Marshal.dump(obj)).

I am sorry but I am not familiar with Marshal much yet. I guess
you serializes and then rebuild the object, but I don't see the
magic to make that efficient (I assumed @value was serialized too)

> > As far as I know the least intrusive notation is to use the [] and []=
> > accessors that you can redefine. Be carefull with []=, the assigned
> > value is not under its control (use xx.[]= yy syntax instead).
>
>Hm, don't really understand that.

a = x[] = b # a == b, whatever the value returned by method x.[]=()
a = x.[]= b # a == value actually returned by method x.[]=()

> > I expect soon to have the issue striking again while implementing
> > "Future". Kind of lazy evaluation. A "Future" is the result of a
> > method call that is not available yet, but you don't mind, until
> > you need it, then you block until it is available. That is a
> > useful concept for distributed computing.
>
>Hm, sounds a bit like Oz :-) or similar to promises in E-lang?

I guess. There are multiple names for this concept.
http://www.c2.com/cgi/wiki?FutureObjects
I think its called Defered in Twisted. Future must have been the
first name, back in the mid 80s.

>Regards,
>   Michael

Thanks again.

Yours,

Jean-Hugues



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


In This Thread