Guest User

Untitled

a guest
May 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. diff --git a/src/multi-dispatch.pod b/src/multi-dispatch.pod
  2. index 67ce236..eb07595 100644
  3. --- a/src/multi-dispatch.pod
  4. +++ b/src/multi-dispatch.pod
  5. @@ -144,12 +144,22 @@ this to count how often a type check occurs:
  6.  
  7. =end programlisting
  8.  
  9. -The first counter output is always C<0>, since the nominal types alone already
  10. -determine which candidate matches best, so the where-block is never executed.
  11. +This code defines three multis, one of which increases a counter whenever its
  12. +C<where> clause executes. Any Perl 6 compiler is free to optimize away type
  13. +checks it knows will succeed. In the current Rakudo implementation, the second
  14. +line with C<say> will print a higher number than the first.
  15. +
  16. +The first C<$counter> output is always C<0>, since the nominal types
  17. +alone already determine which candidate matches best, so the where-block
  18. +is never executed.
  19.  
  20. The second output is at least C<1>. The compiler has to execute the
  21. where-block at least once to check if the third candidate can be called, but
  22. -the specification doesn not require the minimal possible number of runs.
  23. +the specification does not require the minimal possible number of runs.
  24. +This is illustrated in the second C<$counter> output. The specific
  25. +implementation used to run this test actually executes the where-block twice.
  26. +Keep in mind that the number of times the subtype checks blocks are
  27. +executed is implementation specific.
  28.  
  29. =for author
  30.  
  31. @@ -157,11 +167,6 @@ Verify Rakudo * behavior at press time.
  32.  
  33. =end for
  34.  
  35. -This code defines three multis, one of which increases a counter whenever its
  36. -C<where> clause executes. Any Perl 6 compiler is free to optimize away type
  37. -checks it knows will succeed. In the current Rakudo implementation, the second
  38. -line with C<say> will print a higher number than the first.
  39. -
  40. =begin sidebar
  41.  
  42. You I<can> do this, but you should avoid it in anything other than example
Add Comment
Please, Sign In to add comment