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

Explain the compat workflow for functions #827

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

gdalle
Copy link
Contributor

@gdalle gdalle commented May 4, 2024

It may be silly but I spent quite some time trying to make @compat stack([x, y]) work whereas all I needed was Compat.stack([x, y])

@martinholters
Copy link
Member

I'm a bit confused because after using Compat, all of the following should work:

stack([x, y])
Compat.stack([x, y])
@compat stack([x, y])

That said, it may make sense to clarify that @compat is mostly for syntax changes and new functions/methods are just made available by Compat. However, your addition is inserted right before "wherever you want to use syntax that differs", but it's actually not about syntax. Maybe I'm too picky? Would appreciate others to chime in.

@gdalle
Copy link
Contributor Author

gdalle commented May 6, 2024

I'm a bit confused because after using Compat, all of the following should work:

Maybe but the only thing that is mentioned on the README is the macro @compat, and since I qualify all my exports, I only did

using Compat: @compat

That said, it may make sense to clarify that @compat is mostly for syntax changes and new functions/methods are just made available by Compat.

Exactly, that's the part I had not understood.

However, your addition is inserted right before "wherever you want to use syntax that differs", but it's actually not about syntax.

I'll modify the phrasing

Copy link
Member

@martinholters martinholters left a comment

Choose a reason for hiding this comment

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

Ok with me, but I'd really appreciate others' opinions.
(And sorry for the delay.)

@gdalle
Copy link
Contributor Author

gdalle commented May 21, 2024

No worries about the delay. As for the PR, I always welcome more opinions but I feel like it is a relatively low-stakes addition to the docs, so perhaps they are not necessary for merging?

@aplavin
Copy link

aplavin commented Jun 22, 2024

Something like this would indeed be helpful! Maybe stress even stronger that Compat typically doesn't define its own functions, but engages in heavy type piracy? Add a relevant warning to README or something.

I recently spent some time to understand why Iterators.cycle([1,2,3], 5) sometimes works and sometimes doesn't. Turns out, one of my dependencies loaded Compat, and whenever I loaded that dependency this cycle() method worked – but not otherwise.
This definitely doesn't make me want to use Compat myself...

Also #814.

@martinholters
Copy link
Member

Sorry this has fallen through the cracks. No reason not to merge - even if the current phrasing might not be perfect, this PR certainly does not make things any worse.

@martinholters martinholters merged commit f8af0d1 into JuliaLang:master Jun 24, 2024
21 checks passed
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.

3 participants