Jon Lang wrote:
Darren Duncan wrote:
Jon Lang wrote:
Larry Wall wrote:
This is basically a non-problem.  Junctions have one public method,
.eigenstates, which is vanishingly unlikely to be used by accident by
any mere mortal any time in the next 100 years, give or take a year.
If someone does happen to be programming quantum mechanics in Perl 6,
they're probably smart enough to work around the presence of a
reserved--well, it's not even a reserved word-- a reserved method name.
Actually, the problem isn't with '.eigenstates'; the problem is with
'.perl'.  If I'm viewing a Junction of items as a single indeterminate
item, I'd expect $J.perl to return a Junction of the items' perl by
default.  Admittedly though, even that isn't much of an issue, seeing
as how you _can_ get that result by saying something to the effect of
"Junction of $J.eigenstates.«perl" - the only tricky part being how to
decide which kind of junction to use (e.g., any, all, one, none) when
putting the perl-ized eigenstates back together.  (And how _would_ you
do that?)  This would represent another corner-case where the
programmer would be tripped up by a simplistic understanding of what a
Junction is; but being a corner-case, that's probably acceptable.
I would assume that invoking .perl on a Junction would result in Perl code
consisting of the appropriate any/all/etc expression. -- Darren Duncan

Tough to parse, though; and feels like a kludge.  I expect better of Perl 6.

What do you mean by "tough to parse" and "feels like a kludge"? Isn't the point of .perl that it results in a string of Perl 6 code that is a Perl 6 value expression? I wouldn't expect that a Perl 6 expression to result in a Junction is any more difficult to parse than the source code returning an Array or some such.

For example, if you have:

  my $choice = any(1..10);

Then "$choice.perl" should result in code like "any(1..10)". Or "$choice.perl" would approximately be short for the expression:

  'any('~($choice.eigenstates.map:{ $_.perl }.join(','))~')'

... except that the .perl of $choice would also be smart enough to pick 'any'/'all'/etc based on what its Junction value actually is.

Such as that seems perfectly elegant and uncomplicated to me.

If you had a problem with that, then I would expect you'd have a problem with .perl in general for any value, particularly Array etc values.

-- Darren Duncan

Reply via email to