-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Syntactic sugar for ignoring a type parameter #29875
Comments
Related: #24990. These don't necessarily conflict since we can special case the interior of |
Triage: Will wait a bit for the eventual resolution of #24990 |
This is a very good proposal. I am impatient to see this in Base ! After years of discussion, 214 comments over there, what about unsyncing of #24990 to follow its own way... |
As I wrote over there, #24990 is
so it's not as if no progress has been made and this proposal conflicts with that one. |
Thanks for your feedback. I have read your comment before previously posting, |
You will now have
I also suggest to consider
bonus
That will consolidate short forms and bring them to same level of capabilities than long where ones. |
This is certainly a nice feature, but again, the syntax collides with #24990. The question is which feature is more useful/important and worth getting this bit of syntax? You can already use |
I understand your concern about the timeframe and mutual impact. This is just a note to consider when time of choice and/or implementation will come. -- |
Another case to consider (coming from porting of rust code to julia) abstract type Result{O,E} end
struct OK{O} <: Result{O,_}; value::O end
struct Err{E} <: Result{_,E}; value::E end seems clearer than abstract type Result{O,E} end
struct OK{O,E} <: Result{O,E}; value::O end
struct Err{O,E} <: Result{O,E}; value::E end |
Why not save foo(A::Foo{, , , D}, B::Foo{, , , D}) where {D} = ... ? Not having placeholders like |
Quoting big boss JeffBezanson
Code is 90% reading, 10% writing, and sorry, but special form are childhood diseases there. |
About #24990. Nothing personal there but, engineers have to consider some facts about it:
Giving the following ratio
Neither a good way to contribute to foss, neither a foundational work in any way at this stage. |
None of the current ways of doing this
seem easy to read so not sure what point you are trying to make?
A metric like number of lines per month a PR has been opened seems like a bad way to measure progress. Not all lines of code are equal. |
Contrary to #24990 this proposal is actually consistent with the current meaning of |
Wouldn't this idea work better if To illustrate, foo(A::Foo{:, :, :, D}, B::Foo{:, :, :, D}) where {D} seems more ergonomic and isn't conditional on the resolution of 24990. It would be defined to work as: Foo{:} == Foo{<:Any} == Foo{>:Union{}} (Also possible to construct type ranges as @o314 alludes to above, e.g. |
Coming from the Discourse topic by @frankwswang: https://discourse.julialang.org/t/adding-a-type-parameter-annotation-symbol-that-preserves-the-original-bound/122015 The above proposal doesn't make it clear what should happen in a case when some of the parameters of struct Foo{A <: P, B, C, D}
end Which one of these should it be:
The second option seems like a much safer default. |
Consider
and we want to write a binary function where
D
has to match.Possibilities:
How about:
?
Using
_
as an rvalue is deprecated so could this should be available?The text was updated successfully, but these errors were encountered: