Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add pretty printing for splat(f)#42717

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vtjnash merged 11 commits intoJuliaLang:masterfromSeelengrab:splat_printing
May 9, 2022

Conversation

Seelengrab
Copy link
Contributor

When debugging calls with different invocations ofsplat, this helps to identify which function was being splatted into.

master:

julia> Base.splat(cos)#92 (generic function with 1 method)julia> f= Base.splat(sin)#92 (generic function with 1 method)julia>f(1)0.8414709848078965julia> [f]1-element Vector{Base.var"#92#93"{typeof(sin)}}:#92 (generic function with 1 method)julia>using Loggingjulia>@info f[ Info:#92

This PR:

julia> Base.splat(cos)splat(cos)julia> f= Base.splat(sin)splat(sin)julia>f(1)0.8414709848078965julia> [f]1-element Vector{Base.Splat{typeof(sin)}}:splat(sin)julia>@info f[ Info:splat(sin)

Shouldsplat be exported? It's pretty useful.

bramtayl and ToucheSir reacted with thumbs up emoji
@Seelengrab
Copy link
ContributorAuthor

Failures are Distributed related (EAGAIN: Resource temporarily not available), seems like some tasks can't spawn theirsetenv(...) invocations. Unrelated to this PR.

@mbaumanmbauman added the display and printingAesthetics and correctness of printed representations of objects. labelOct 20, 2021
@mbauman
Copy link
Member

What if we printed it likex -> sin(x...)? That way it'd tell you what it did? Or is that too fancy?

@Seelengrab
Copy link
ContributorAuthor

Seelengrab commentedOct 20, 2021
edited
Loading

Well it'd be lying to you, as that's not how its implemented (edit: in this PR) 🤷 That used to be the old implementation though. Changing it was necessary to allow for easier printing.

Compared to the old way of just printing whatever number anonymous function the result ofsplat happened to be, this representation is already a big step up and allows you to do?Base.splat(sin) (we'd have to export it to make?splat work) and you'll get the docs for it, where it says that this is equivalent to the lambda version.

Since it's not exported, I don't think it's used very wildly right now. I'm working on a package (PropCheck.jl) where usingsplat to interact with it makes everything a bunch easier (see e.g. the tests inBigNums.jl). I got annoyed with not knowing which function was wrapped, hence this PR.

@Seelengrab
Copy link
ContributorAuthor

I'm talking about this PR 😅 In this PR, this is no longer a simple anonymous function, precisely because it makes printing easier. If it were not for the new struct, I'd have to callsplat first, to get the anonymous function to customize its printing.

Moelf reacted with thumbs up emoji

@Seelengrab
Copy link
ContributorAuthor

I should note that this works the exact same way as the anonymous function, except doing the hoisting to astruct manually instead of implicitly by the compiler.

@vtjnash
Copy link
Member

string can be overloaded, though it is uncommon, and usually just for performance to give the same result

@Seelengrab
Copy link
ContributorAuthor

I think you meant to answer in the review thread above ;)

@Seelengrab
Copy link
ContributorAuthor

I've incorporated the feedback, fixed printing, added the deprecation and replaced uses of the old syntax in the rest of Base. It's also rebased to the current master. Now let's hope nothing broke 😬

@Seelengrab
Copy link
ContributorAuthor

Seelengrab commentedMar 9, 2022
edited
Loading

Rebase & rerun of CI - I've also moved the deprecation notice to the 1.9 deprecation block, since this definitely isn't going to make 1.8 anymore. I'll write NEWS.md once CI is happy.

@vtjnash
Copy link
Member

Add export?

Seelengrab reacted with thumbs up emoji

@Seelengrab
Copy link
ContributorAuthor

$ /etc/buildkite-agent/plugins/github-com-JuliaCI-external-buildkite-buildkite-plugin-v1/hooks/post-checkout
--
  | fatal: destination path '.buildkite' already exists and is not an empty directory.
  | 🚨 Error: The plugin external-buildkite post-checkout hook exited with status 128

Uuh.. Unrelated? Doesn't look good though..


In either case, I've also added a NEWS.md entry since CI was green last night. Should be good to go now.

@Seelengrab
Copy link
ContributorAuthor

The macos failure seems to stem fromLibgit2:

Test Failed at /Users/julia/buildbot/worker-tabularasa/tester_macos64/build/share/julia/stdlib/v1.9/LibGit2/test/libgit2.jl:1754
Expression: LibGit2.headname(repo) == master_branch
Evaluated: "main" == "master"

@Seelengrab
Copy link
ContributorAuthor

I don't know where this should fall in the release cycle, but it'd be nice to get this in a future 1.9 :)

@Seelengrab
Copy link
ContributorAuthor

Rebase onmaster!

@Seelengrab
Copy link
ContributorAuthor

Failure in BuildKite macOS iscmdlineargs, seems unrelated.

@vtjnashvtjnash added the merge mePR is reviewed. Merge when all tests are passing labelApr 24, 2022
@vtjnashvtjnash merged commitef10e52 intoJuliaLang:masterMay 9, 2022
@SeelengrabSeelengrab deleted the splat_printing branchMay 9, 2022 15:47
@giordanogiordano removed the merge mePR is reviewed. Merge when all tests are passing labelMay 13, 2022
@mcabbottmcabbott mentioned this pull requestJun 11, 2022
@knueselknuesel mentioned this pull requestDec 29, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@simeonschaubsimeonschaubsimeonschaub left review comments

@MoelfMoelfMoelf left review comments

@mcabbottmcabbottmcabbott left review comments

@vtjnashvtjnashAwaiting requested review from vtjnash

Assignees
No one assigned
Labels
display and printingAesthetics and correctness of printed representations of objects.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

8 participants
@Seelengrab@mbauman@vtjnash@simeonschaub@Moelf@mcabbott@giordano@DilumAluthge

[8]ページ先頭

©2009-2025 Movatter.jp