[#1026] Is this a bug? — Dave Thomas <Dave@...>
18 messages
2000/01/03
[#1053] rand() / drand48() — ts <decoux@...>
11 messages
2000/01/05
[#1055] Re: rand() / drand48()
— matz@... (Yukihiro Matsumoto)
2000/01/05
[#1061] Re: rand() / drand48()
— gotoken@... (GOTO Kentaro)
2000/01/07
Hi,
[#1067] Here docs not skipping leading spaces — Dave Thomas <Dave@...>
5 messages
2000/01/08
[#1083] YADQ (Yet Another Dumb Question) — Dave Thomas <Dave@...>
12 messages
2000/01/10
[#1084] Infinite loop — Dave Thomas <Dave@...>
17 messages
2000/01/11
[#1104] The value of while... — Dave Thomas <Dave@...>
24 messages
2000/01/11
[#1114] Re: The value of while...
— Dave Thomas <Dave@...>
2000/01/12
matz@netlab.co.jp (Yukihiro Matsumoto) writes:
[#1128] Re: The value of while... — David Suarez de Lis <excalibor@...>
Hi all,
1 message
2000/01/12
[#1133] Re: Class variables... — David Suarez de Lis <excalibor@...>
Hi there,
2 messages
2000/01/12
[#1158] Is this expected behavior? — Dave Thomas <Dave@...>
6 messages
2000/01/21
[#1172] Re: Possible bug in ruby-man-1.4 — Huayin Wang <wang@...>
> |Well, I guess it comes down to what you mean by an integer
10 messages
2000/01/24
[#1177] Re: Possible bug in ruby-man-1.4
— Dave Thomas <Dave@...>
2000/01/25
matz@netlab.co.jp (Yukihiro Matsumoto) writes:
[#1188] Enumerable and index — Dave Thomas <Dave@...>
5 messages
2000/01/27
[#1193] Semantics of chomp/chop — Dave Thomas <Dave@...>
7 messages
2000/01/28
[#1197] Question about 'open' — Dave Thomas <Dave@...>
8 messages
2000/01/30
[ruby-talk:01201] Re: Question about 'open'
From:
Dave Thomas <Dave@...>
Date:
2000-01-30 15:54:15 UTC
List:
ruby-talk #1201
ts <decoux@moulon.inra.fr> writes:
> >>>>> "D" == Dave Thomas <Dave@thomases.com> writes:
>
> D> D'accord! But I'm wondering why it is. The semantics of the open have
> D> it returning a result to both the parent and the child. It can't do
> D> that without executing the block, so shouldn't it be running the block
> D> in both places?
>
> i.e. make a special case for - ?
Actually, I'd say that |<cmd> is the special case. The normal action
of 'open' is to return the File, either as a result or to the
block. If you use
f = open("|-")
or
f = open("|stuff")
the semantic is continued - it returns the File (or nil), both to the
child and to the parent.
So, continuing the theme
open("|-") { |f| ... }
should be no different - it should give the block the File in the
parent and nil in the child.
But... I can see the argument the other way, that the block should
only be executed in the parent (the current behavior). In terms of
explaining what's going on, the current behavior is probably easier
too. It just surprised me when it happened.
Regards
Dave