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

Add RFC-1112 - "Obsolete allowed to use Obsolete" #617

Merged
merged 10 commits into from
Aug 10, 2021

Conversation

WhiteBlackGoose
Copy link
Contributor

@WhiteBlackGoose WhiteBlackGoose commented Aug 10, 2021

It's not yet approved in principle, so I keep it as draft

Suggestion

@Happypig375
Copy link
Contributor

No distinction between whether the IsError of ObsoleteAttribute is true or not?

@WhiteBlackGoose
Copy link
Contributor Author

Good point. I will add info about it too

- [ ] Approved in principle
- [ ] [Implementation](https://github.com/dotnet/fsharp/pull/FILL-ME-IN)
- [ ] Design Review Meeting(s) with @dsyme and others invitees
- [Discussion](https://github.com/fsharp/fslang-design/discussions/FILL-ME-IN)
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing discussion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I already should start one, since it's not yet approved

RFCs/FS-1112-obsolete-allowed-to-use-obsolete.md Outdated Show resolved Hide resolved
RFCs/FS-1112-obsolete-allowed-to-use-obsolete.md Outdated Show resolved Hide resolved

# Summary

The general idea is to allow types and functions marked with `System.ObsoleteAttribute` to use other `Obsolete`-marked members without

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If mentioning Modules separetely, then I guess i should add all combinations related to them to the Design section?



New text for the warning will indicate that the outer member should be marked `Obsolete`, like we do it
with `async` in C#. For example, `The construct is deprecated and should not be used. Consider marking the outer function or type as Obsolete.`
Copy link
Contributor

Choose a reason for hiding this comment

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

Add the message from C#

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why should you expect everyone to be familiar with what C# does?

Copy link
Contributor Author

@WhiteBlackGoose WhiteBlackGoose Aug 10, 2021

Choose a reason for hiding this comment

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

That's not essential to be familiar with it to understand the new text. But those who are familar will understand the analogy. But if necessary, I can add info about the C#'s message or remove the mention of C# completely

with `async` in C#. For example, `The construct is deprecated and should not be used. Consider marking the outer function or type as Obsolete.`

# Drawbacks

Copy link
Contributor

Choose a reason for hiding this comment

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

Potential for abuse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't think of any potential for abuse at the moment. Let me know if there's some case


#### 5. IsError property effect

* `Obsolete(_, (*IsError:*) true)` can use `Obsolete(_, (*IsError:*) true)`
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the named argument syntax

open System
[<Obsolete("", error=true)>] type A = A

@WhiteBlackGoose
Copy link
Contributor Author

@Happypig375 I added a comment about C# ignoring error= thing

@WhiteBlackGoose WhiteBlackGoose marked this pull request as ready for review August 10, 2021 13:46
@dsyme
Copy link
Contributor

dsyme commented Aug 10, 2021

This is good enough for starting point, I like it, thanks

@dsyme dsyme merged commit d2e45ea into fsharp:main Aug 10, 2021
@WhiteBlackGoose
Copy link
Contributor Author

@dsyme now I'd want to resolve the unresolved question and start working. Should there be something else done before I start?

@dsyme
Copy link
Contributor

dsyme commented Aug 11, 2021

@dsyme now I'd want to resolve the unresolved question and start working. Should there be something else done before I start?

The behaviour should follow C#

@dsyme
Copy link
Contributor

dsyme commented Aug 11, 2021

Should there be something else done before I start?

Feel free to start! I imagine it will be a matter or computing a flag and holding it in TcEnv, and propagating that through to AttributeChecking.fs

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