Can we introduce syntax desugaring for type-apply update? #21571
WojciechMazur
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here's example of compile-time or runtime-checked arrays with bounds. Scala allows to definition a desugaring for
def update(idx: Int, v: T): Unit
allowing to usex(idx) = v
. However, the limitation of this feature is the fact that we need to pass arguments always in the apply arguments. When we compare it with type-applyapply
method.I wonder if the compiler could also accept the additional desugaring for type-apply based calls which would allow to implement a symetrical apply/update methods using type apply. The idea is to allow to switch easily from runtime-checked to compile-time checked bounds by only changing type of brackets.
Beta Was this translation helpful? Give feedback.
All reactions