On Mon, Jul 12, 2004 at 11:11:58AM -0700, Austin Hastings wrote: : --- Larry Wall <[EMAIL PROTECTED]> wrote: : > The hard part being to pick a random number in [0,Inf) uniformly. :-) : : Half of all numbers in [0, Inf) are in the range [Inf/2, Inf). Which : collapses to the range [Inf, Inf). Returning Inf seems to satisfy the : uniform distribution requirement: if you have a number you're waiting : to see returned, just wait a bit longer...
Yeah, but it doesn't satisfy the random requirement very well, unless Inf == 42 some infinitesimal part of the time. : > Certainly you can do that, but it'll only work if some version of : > rand declares either a ?$bell_curve option or a +$bell_curve option. : : > (And the latter will work only if we can extend multiple dispatch to : > pay attention to named parameters, which we've explicitly put into : > the category of things the Parrot folks are allowed to ignore for : > 6.0.0.) : : Why is this a parrot-ism and not a P6-ism? The behavior of multiple : dispatch, itself supposedly a tunable thing, seems likely to be a : P6-internal rather than a Parrot thing. (In fact, I would think this is : a simple behavior: discover the "rand" token, realize that there's a : multi sub with that name, emit a MD call, keep going.) Parrot's MD only supports positional arguments for now. All named arguments *could* in theory be mapped to positions if you know all the declarations for a particular name, but things get hairy when two different sub declarations put their positional parameters (which *may* be called by name) in different orders. That's the basic problem. It's one of those things that we know is possible to solve inefficiently, but we're not sure we want to solve it efficiently for 6.0.0. If you want to work it all out, though, many of us would be overjoyed. There may be some intermediate solutions for when we know the parameter orderings are consistent, of course, and if one of those solutions made it into 6.0.0, it wouldn't prevent a more general solution later. I think that's the likeliest scenario. People will want to do MD on named parameters, as the rand example illustrates. Depending on the solution, that might force us to declare ?$bell_curve rather than +$bell_curve for now, or transmogrify some +$bell_curve declarations into ?$bell_curve declarations internally so that Parrot's MD engine has a position for them. Larry