Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare RakuAST branch to become main #5123

Merged
merged 135 commits into from Dec 11, 2022
Merged

Prepare RakuAST branch to become main #5123

merged 135 commits into from Dec 11, 2022

Conversation

vrurg
Copy link
Member

@vrurg vrurg commented Dec 9, 2022

vrurg and others added 30 commits July 12, 2022 23:00
Multi-dispatch failure due to attempt of dispatching over a non-puned
role.
…regression

Fix a regression where coercing into a role didn't work
Inspired by https://stackoverflow.com/questions/72809469/in-raku-how-does-one-write-the-equivalent-of-haskells-span-function

Changed the name from "span" to "snip" because of slightly extended functionality from "span" because the condition can also be a List of conditions
(in the sub case), or just have multiple conditions (in the method case).

A "snip" in the provided Iterable will occur whenever a smartmatch with the given value returns False.  It will then go on to the next condition (if any).  If no other conditions are given, will produce the rest of the Iterable.

    .say for snip * < 10, 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
    (2 2 2 5 5 7)
    (13 9 6 2 20 4)

    .say for snip (* < 10, * < 20), 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
    (2 2 2 5 5 7)
    (13 9 6 2)
    (20 4)

    .say for (2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4).snip( * < 5, * < 10 );
    (2 2 2)
    (5 5 7)
    (13 9 6 2 20 4)

    .say for (2, 2, 2, 5, 5, "a", "b", "c").snip: Int;
    (2 2 2 5 5)
    (a b c)

    .say snip Int, 2, 2, 2, 5, 5, "a", "b", "c");
    (2 2 2 5 5)
    (a b c)

This implements both the method (on Any-iterable, as well as on Supply) and the sub version of "snip".

Span documentation: https://hackage.haskell.org/package/base-4.16.1.0/docs/Prelude.html#v:span
This makes:

    my str $a = "foo bar baz";
    my int $f = 4;
    my int $c = 2;
    say substr $a, $f;      # bar baz
    say substr $a, $f, $c;  # ba

about 2.8x as fast.
This changes the behaviour of .hyper/.race when given an undefined
value for :batch / :degree.  Before, this was an error.  With this
commit, it will assume the default values.

This makes it much easier to let e.g. CLI's manage defaults for
:degree and :batch, without needing to know what the defaults
actually are.  Just accept --degree and --batch without default
values, and pass them on.
Solaris always returns 0 in max-rss. According to the NOTE in
getrusage(3C):

  The ru_maxrss, ru_ixrss, ru_idrss, and ru_isrss members of  the rusage
  structure are set to 0 in this implementation.
Apply only when a method is added to a HOW capable of doing fallbacks
which is currently ClassHOW only.

Fixes rakudo#4983
Implement lazy 'handles' trait application for methods
If the method is delegating then metamodel invokes `apply_handles` for
each its copy in the method table causing 'method is already defined'
error for delegations. For now it is only `Method::Also` is known which
does this kind of duplication.

The fix is implemented with an additional `:$handles` argument. If true
then no attempt to call `apply_handles` is done.

Until `Method::Also` incorporates support for this argument a workaround
step is done where we make sure that the method object hasn't been
previously installed in the table. This step is to be eliminated as soon
as use of `:!handles` argument is ensured where necessary.

Also added support for using `handles` on multi-candidates. For the
moment this support is also suceptible to the method object duplication
problem. But there is no simple fix for this, so just hoping for
`:!handles` again.
Get around a problem where a module duplicates method objects
This resulted in an execution error:

    my %*SUB-MAIN-OPTS = :named-anywhere; sub MAIN(|) { }; @*ARGS = "-"

Without :named-anywhere, the lone "-" was already considered a
positional argument.
- The dispatcher itself never expects a containerized coercer, but it
  was possible for the metamodel to bypass a container
- The scalar case of value was considerd, but `Proxy` has been
  overlooked; if there be any other kind of container it should be
  handled appropriately too
It was part of the old return value coercion implementation.
Fix some cases of coercion over containerized values
This reverts commit 50025c1.

In response to rakudo#4949, will revisit this at a later time, most likely
post RakuAST merge
Fixes DateTime(Str).ACCEPTS(True), which was the new reason why the
code of rakudo#4278 failed.
For `6.c/d` name-based `self."$delegator"()."$delegation"()` is used.
Make code object based delegation 6.e feature
This reverts commit 4fc3d45.

I've come to the conclusion that the problem described in rakudo#4949
exists before and after the revert.  Since the revert appears to
cause a new issue, I'm reverting the revert.

So now we're at a version back again with a CUR::Staging with its
own "candidates" method.
This makes ++$a about 40% faster when $a is a native uint
Add instructions on how to call set-env.sh from .bash_profile and similar.
Introduce `--quiet` flag to make the script quiet.
Prepare for rakudo#4993.
The following will now produce correct true output:

    subset Foo of Int();
    say Foo:D.^archetypes.coercive;

Also note the use of `.^archetypes` notation.

The target is achieved by parameterizing definites with an additional
argument and adding optional `$obj` positional parameter, akin to many
other user-land accessible methods invoked via `.^` notation.

The additional parameterization argument is an index built from
definite's base type `coercive` and `generic` values by considering them
as bits and doiing `($coercive +< 1) +| $generic`. The index is then
pulled from the typeobject parameterization arguments and used to choose
the right archetypes instance from a list of predefined
`Perl6::Metamodel::Archetype` instances.

In particular, this commit fixes a case like the following:

    role R[::T, $default] {
        has T:D $.a = $default;
    }
    class C does R[Int, 42] { }

Prior this was failing due to `T:D` was not instantiated a was failing
type check.

Many other cases of using definite generics are supposedely to be fixed
too.
lizmat and others added 25 commits November 5, 2022 18:55
It was a stupid error of doing one-way type check because if, say, we
ask if a `Real`-typed entity can be `Int` then the answer is 'yes'
because eventually it can. But the same applies to an `IntStr`-typed
entity because, in fact, it is already `Int`.
Fixes a regression discussed on #raku-dev
https://irclogs.raku.org/raku-dev/2022-11-11.html#08:39

    my %h = a => 1, b => 2; EVAL("say %h ~~ :2b");
    # No such method 'b' for invocant of type 'Hash'
Thanks to the work of Daniel Green++, NQP now has a nqp::chown op
that can be used to change owner and group of a given path.

Both the subroutine as well as the method version take a :uid and
a :gid named argument that should be specified with the integer
value of the uid/gid to change.  The default for :uid and :gid are
the current setting of the path (aka, omitting will not change the
value for that aspect of the file).

IO::Path.chown will throw a new X::IO::Chown exception if failed.
chown() will just return the paths of which the chown succeeded,
in correspondence with the other IO::Pathy subs.
They proved to be unclaimed. Besides, if needed, they can be replaced
with new-disp implementations. That is likely to be even more efficient.
Therefore it makes sense to spare some memory by getting rid of the ops.
This fixes the presumption that .words is like .comb(/ \S+ /).
If we're assigning to an '@' or '%' sigiled container, mention that the
problem is with an element of the container. Potentially addresses rakudo#5110
so now something like `my Map %m = "abc", "def";` says `Type check
failed in assignment to an element of %m; expected Map but got Str
("def")` instead of just `Type check failed in assignment to %m;
expected Map but got Str ("def")`.
Get some more digits for the case when denominator length is smaller than expected.
Fixes rakudo#5108
For container assignment type errors, change the message from:
"Type check failed in assignment to an element of <symbol>; expected <type> but got <type> (<value>)"
to 
"Type check failed for an element of <symbol>; expected <type> but got <type> (<value>)".

This removes possible confusion about assignment syntax. Possibly resolves  rakudo#5110.
In response to rakudo#5116

infix:<eqv> falls back to the calling .raku if two objects are of
the same type.  This makes sure that WhateverCode.raku will produce
different strings for different WhateverCode objects.
Avoid loss in precision on FatRat .Str conversion
This reverts commit 6cded78.

Appears that WhateverCode checks were broken, which will need
further investigation, so revert to let 2022.12 release go through
Safety `$*CTXSAVE` declaration wasn't available to the runtime of
compiled code.
@vrurg
Copy link
Member Author

vrurg commented Dec 10, 2022

My current plan for this:

  • Make the final approval of The Raku Steering Council
  • Make sure @jnthn doesn't object
  • Merge into the rakuast branch
  • Rename into main
  • Set github primary branch to main

Better have it done by Sunday, Dec 11 Unlikely because tooling has to be adjusted. But having the main ready to use is possible.

@vrurg vrurg merged commit f2031ec into rakudo:rakuast Dec 11, 2022
@lizmat
Copy link
Contributor

lizmat commented Dec 11, 2022

Congrats!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet