Skip to content

Conversation

matthias314
Copy link
Contributor

@matthias314 matthias314 commented Apr 12, 2024

This PR makes the following symbols from Base.Broadcast public:

  • Symbols appearing in the documentation, with docstring
AbstractArrayStyle
ArrayStyle
Broadcasted
DefaultArrayStyle
Style
combine_axes
combine_styles
flatten
instantiate
result_style
  • Symbols appearing in the documentation, without docstring
Unknown
  • Symbols not appearing in the documentation, with docstring
materialize

I think it makes sense to make it public given that Broadcasted is also public.

  • Symbols not appearing in the documentation, without docstring
DefaultMatrixStyle
DefaultVectorStyle

I think it makes sense to have them available as shortcuts. Maybe one should even mention them in the documentation instead of using DefaultArrayStyle{1}, for example.

EDIT: Making DefaultVectorStyle and DefaultMatrixStyle public leads to failing doctests because they now appear in the Julia output instead of DefaultArrayStyle{1} and DefaultArrayStyle{2}. However, they are never used in broadcast.jl. If one doesn't want to have them public, why are they defined at all? Let me know if you want to have them public. Then I adjust the documentation.

  • The following functions have been left out although they have docstrings:
broadcast_preserving_zero_d
broadcast_shape
make_makeargs
newindex
_broadcast_getindex
  • The following symbol (with docstring) is currently exported without appearing in the documentation:
BroadcastFunction

@matthias314 matthias314 changed the title add public statement to broadcast.jl add public statement to Base.Broadcast Apr 12, 2024
@matthias314
Copy link
Contributor Author

matthias314 commented Apr 14, 2024

I've removed DefaultVectorStyle and DefaultMatrixStyle from the list of public symbols.

@matthias314
Copy link
Contributor Author

@LilithHafner Any feedback on this?

@LilithHafner
Copy link
Member

Thanks for the bump.

  • I don't think we should mark anything without a docstring as public without also adding a docstring.
  • I don't know the broadcast internals well enough to provide robust feedback on the specific choices here but I'll try to find someone(s) who is.

@matthias314
Copy link
Contributor Author

Any news?

I can add a docstring for Broadcast.Unknown if you want. The only occurrence of Unknown is in some output inside the examples section of the docstring for Broadcast.result_style. If we work on this, should we also consider renaming it? I think that UnknownStyle would be more informative.

@nsajko nsajko added broadcast Applying a function over a collection design Design of APIs or of the language itself labels Sep 13, 2024
@Tokazama
Copy link
Contributor

Tokazama commented Aug 3, 2025

I was pretty surprised to find out these didn't make the first round of public declarations. Is there any reason this hasn't been pushed forward?

@matthias314
Copy link
Contributor Author

I was waiting for feedback about how to proceed with Broadcast.Unknown. Should it be public? If yes, should it be renamed to UnknownStyle?

@LilithHafner LilithHafner added the triage This should be discussed on a triage call label Aug 4, 2025
@Tokazama
Copy link
Contributor

Tokazama commented Aug 5, 2025

I think namespacing it makes it less of a problem to rename it as UnkownStyle. It's always nice to have a consistent syntax. TBH, rules related to naming styles and enums in Julia are lost on me.

@matthias314
Copy link
Contributor Author

What does this mean in terms of answers to my two questions?

@Tokazama
Copy link
Contributor

Tokazama commented Aug 6, 2025

Sorry, I saw the triage label and justj added a quick opinion instead of answering any solid questions.

  1. It should be public since it's a pretty important part of the other methods being made public here.
  2. Renaming it isn't necessary to avoid conflicts or confusion because there isn't going to be another Broadcast.Unknown, leaving info a simple doc string away from understanding. However, it's always nice to conform to a syntactic standard.

That being said, triage may have a different response.

@@ -1179,7 +1179,7 @@ f51129(v, x) = (1 .- (v ./ x) .^ 2)
@testset "Docstrings" begin
undoc = Docs.undocumented_names(Broadcast)
@test_broken isempty(undoc)
@test undoc == [:dotview]
@test undoc == [:Broadcasted, :Unknown, :dotview]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add docstrings instead of adding exceptions to this test.

@LilithHafner
Copy link
Member

Triage thinks that this is generally fine but defers to @mbauman to make sure that these are actually the public API of broadcasting.

@LilithHafner LilithHafner requested a review from mbauman August 14, 2025 18:25
@LilithHafner
Copy link
Member

Should Base.broadcasted be public, too?

@Tokazama
Copy link
Contributor

Should Base.broadcasted be public, too?

I'm in favor of making it public if we can agree on an interface, because I recall having to override it sometimes. For example, documenting that new method definitions should dispatch on specifically on the Base.broadcasted(::MyStyle, f, args...) to avoid ambiguities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broadcast Applying a function over a collection design Design of APIs or of the language itself triage This should be discussed on a triage call
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants