--sm4nu43k4a2Rpi4c
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Jan 29, 2011 at 09:45:30AM +0900, Charles Oliver Nutter wrote:
> On Fri, Jan 28, 2011 at 5:29 PM, Aaron Patterson
> <aaron / tenderlovemaking.com> wrote:
> > My point is that it seems that LSP is broken. Either Fiber should
> > respond to "call" and "[]", or Proc should respond to "resume". Really
> > I don't care which.
> 
> LSP says the opposite. Assuming (from your interpretation of Knuth and
> LSP) that coroutines (Fibers) are a generalization of subroutines
> (procs), and conversely subroutines (procs) are a specialization of
> coroutines (Fibers), then T = coroutines (Fibers), S = subroutines
> (procs) and...
> 
> "Let q(x) be a property provable about objects x of type T. Then q(y)
> should be true for objects y of type S where S is a subtype of T."
> 
> So subroutines (procs) should do everything Fibers can do, but not the
> inverse relationship. This would also imply that subroutines should be
> resumable, etc.
> 
> However...I'm not sure what Knuth was saying is implying a
> generalization/specialization relationship. He was saying subroutines
> óż coroutines. So you should be able to expect that for all operations
> q on coroutines there should be a matching operation q on subroutines
> and vice versa. Doesn't this mean we should also have resuming,
> yielding, etc on subroutines? (please no)
> 
> So...there are three possibilities:
> 
> 1. subroutines are a specialization of coroutines. Then it's perfectly
> valid for subroutines to define things coroutines do not.

Yes, but it is *not* perfectly valid for subroutines to *not* define
things that coroutines do.  We can either resolve that by defining
"resume" on Proc, or "call" and "[]" on Fiber.

> 2. subroutines are equivalent to coroutines. Then coroutines should
> add [] and call and subroutines should have resuming/yielding
> capabilities.
> 3. coroutines are a specialization of subroutines. Then coroutines
> should add [] and call, and we're done. And Knuth is wrong.

> 
> Now that I've thoroughly confused myself, I'll leave it up to you and
> ruby-core... which reality would you like?

I have been trying to choose reality number 1, the entire time, but
apparently I cannot explain myself clearly. :'(

-- 
Aaron Patterson
http://tenderlovemaking.com/

--sm4nu43k4a2Rpi4c
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)

iQEcBAEBAgAGBQJNRFFJAAoJEJUxcLy0/6/GgQ8IAIMiZqijNwQFLJk875T9EHdk
aedkdByw4+iOox4tg1XXmvi7TbJ+hi3ZGMcRZjw0Tpldn52mUcyNXXAhaAZsQD/1
EIeDsQhUIqsXVY9qkdzlSS5BgwYqHfSBx3t+wro1WRYyTkhJ6TyJfyj3urxlvXVR
D/ZK2YGqRiGR1RKgucA+gUnqSdUB2Eo9B09c6DgYMQKvnfoAld/SIsaPc4y2wvPG
oZlCFzXOWsrbdTVTrSpqc3Sxmvw2R460BauZlyWFt2pWw2RyhnR4vdY5Td3tYHwq
K3CMCWyxHbpJ9KyRE+XMFhxvN1Km9Z6wu3dESaT4fsGleBO9/N2SsvCiudoKSkEOf
-----END PGP SIGNATURE-----

--sm4nu43k4a2Rpi4c--