-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Trial: Go back to witness syntax #7928
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
Conversation
This is an attempt to validate the current given design against my very first proposal from more than a year ago: witnesses. I have duplicated the docs, replacing syntax and terminology,
I still think it doesn't read as idiomatic English -- I don't know anybody outside of hardcore computer science who ever uses the word "witness" like that. Can't speak for the rest of the world, but I personally don't think it would teach well to native English speakers... |
https://english.stackexchange.com/questions/167683/witness-to-vs-witness-of/168408 The noun form is "witness of". So this looks like idiomatic english to me. It might be rarely used in common language, but that's OK as far as I am concerned. We are talking about a concept that will be novel to new users. So it's OK to use an uncommon term and fill it with meaning. |
Also: the very first example in Merriam Webster says: the ruins are a compelling witness of the ancient civilization's cultural and aesthetic achievements |
Sure, but that's a fine example of what I mean: that's essentially an archaic form of speech. It would have sounded entirely normal a century ago, and a bit quaint when I was a child, but the language has evolved rapidly since then. I can't remember seeing a sentence like that outside of academia or religion in recent decades, and rarely even there. I'm using "idiomatic" quite precisely here. It is legal English -- but so is all of Shakespeare. It isn't how people actually use the language in regular practice any more, though. In practice, the non-verb form "witness" is rarely used except when describing a human being, and even that not especially often outside of a courtroom... |
While witness isn't commonly used out of legal settings, it works well with the term evidence, which the compiler currently uses. And it is grammatically correct. I still don't like them because they are used to suggest or talk about something abstractly and not used in a concrete sense. |
(at this point I don't have a clear overview in my head of all the different possibilities and their pros and cons, so I can't confidently say what I think is best, big-picture, but regardless:) I would love it if we can find a noun that isn't "given". I have tried, but I have been unable to get used to talking/thinking about "givens" as a thing. I'm delighted to hear that choosing a different noun is still a possibility (I'd sort of "given" up on it). perhaps "witness" isn't the perfect noun; perhaps there isn't any perfect noun; but IMO it's a better noun than "given"
the important thing is not to give a clear impression that is also a wrong impression. I think "witness" doesn't give a clear but wrong impression; rather, it gives a "hmm, what's that, tell me more" impression and that's okay:
agree |
The important piece is finding the right terminology to transform the world of Scala 2 implicits such that whatever new keyword(s) are added somehow convey the semantics of use. For example, with typeclasses instance is a natural fit, and given also works quite well as a replacement for implicit parameters, but these two terms are perhaps not enough to capture the range of functionality provided by Scala implicits. Side note: the multi-soft keyword approach |
My evaluation so far:
|
Outside the Scala community, Scala is often regarded as an 'academic' language. This is not a view I agree with, but it is also not something we should ignore. Using keywords like witness is bound to strengthen this view, rather than diminish it. Personally, I don't care that much about which keyword is chosen and I could get used to witness. However, I am already hooked to Scala, and I think things like witness might be off-putting to potential new Scala developers. |
I'm not sure if it's been suggested before, but Pros:
Cons:
I'd like to add that I think the |
I decided to pursue #8017 instead. |
This is an attempt to validate the current given design against my very first proposal
from more than a year ago: witnesses. I have duplicated the docs, replacing syntax
and terminology.
To get started with browsing: https://github.com/dotty-staging/dotty/blob/try-witness/docs/docs/reference/contextual-witnesses/motivation.md