Skip to content

Instantly share code, notes, and snippets.

@Whateverable
Created July 31, 2023 23:41
Show Gist options
  • Save Whateverable/59a4406e5b8af03441cc8c0b74098e85 to your computer and use it in GitHub Desktop.
Save Whateverable/59a4406e5b8af03441cc8c0b74098e85 to your computer and use it in GitHub Desktop.
bisectable6
say 'almafa' ~~ Real()
Bisecting: 73 revisions left to test after this (roughly 6 steps)
[fa2013db402b99f8ebadf8ccb770b4ebeba3027e] Don't use "perl" in identifiers unless needed
»»»»» Testing fa2013db402b99f8ebadf8ccb770b4ebeba3027e
»»»»» Script output:
False
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
False
»»»»» The output is identical
»»»»» Therefore, marking this revision as “old”
»»»»» -------------------------------------------------------------------------
»»»»» Testing a3ed02042e2de502a9e55640a9d3b80dc1e9bfaf
»»»»» Script output:
True
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
False
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing f4f5d2c1bebd85a874b723cefd86f665bfad27bb
»»»»» Script output:
True
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
False
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing ea2fdd2f039889db81f94f2c243b50e1b30317c0
»»»»» Script output:
True
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
False
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 2675813fd2c63f65938a9940ad1734d47fa6a940
»»»»» Script output:
CoercionHOW.compose(Real(Any)|94070042863248) Real Any
True
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
False
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 2a5dd9e6ec55bb7f28341af2a9d399564e1b23ee
»»»»» Script output:
False
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
False
»»»»» The output is identical
»»»»» Therefore, marking this revision as “old”
»»»»» -------------------------------------------------------------------------
»»»»» Testing f2d73287f95ad6fa9eba8856ad15f3e8f9076d6e
»»»»» Script output:
CoercionHOW.compose(Real(Any)|94092240103328) Real Any
True
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
False
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
f2d73287f95ad6fa9eba8856ad15f3e8f9076d6e is the first new commit
commit f2d73287f95ad6fa9eba8856ad15f3e8f9076d6e
Author: Vadim Belman <vrurg@lflat.org>
Date: Fri Aug 28 22:11:02 2020 -0400
The first draft of new coercion semantics
This is a research work inspired by rakudo/rakudo#1285. The following
changes are included:
- Coerions are made first-class type objects. It's now possible to pass
a coercion around normally. Non-instantiable though akin to definites
and subsets.
- A parameter is now marked as `coercive` if its type is a coerce.
- Coercions redelegate method calls to their target type.
- Coercions type checks almost as they should. This is a temporary
situation. Yet, `Str ~~ Int(Str)` is `True`, and 'Rat ~~ Int(Str)` is
`False`.
- Coercions are nominalizable. Nominalize into the target type.
Aside of these, coercion protocol is introduced. If `coerce` method of
`Metamodel::CoercionHOW` is used for `Foo(Bar)` then the following
methods are tried in the order of mentioning:
- the current standard of `Bar.Foo`
- `Bar.COERCE-INTO(Foo)`
- `Foo.COERCE-FROM(Bar)`
Considering the discussion in Raku/problem-solving#137, the last one is
the fallback of despair because, as was mentioned in the ticket, `Foo`
might not have full information about `Bar` state and thus may not
result in proper coercion. But the approach is safe to use for coercing
from simple type objects. And in any case I think it is better to have
something than have nothing and be forced to use augmentation.
In either case, the use of `COERCE-*` methods allows to handle types
with compound names without the risk of name clashes if short names of
two or more type objects match.
src/Perl6/Actions.nqp | 82 +++++++++++++++++++-
src/Perl6/Metamodel/CoercionHOW.nqp | 145 ++++++++++++++++++++++++++++--------
src/Perl6/World.nqp | 2 +-
src/Perl6/bootstrap.c/BOOTSTRAP.nqp | 26 +++++--
src/core.c/Parameter.pm6 | 8 ++
5 files changed, 223 insertions(+), 40 deletions(-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment