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

Change ? to another symbol #84

Closed
nightscape opened this issue Nov 30, 2018 · 5 comments · Fixed by #91
Closed

Change ? to another symbol #84

nightscape opened this issue Nov 30, 2018 · 5 comments · Fixed by #91

Comments

@nightscape
Copy link

It seems like Dotty will get native type lambdas. The plan there is to use F[_] as a short-hand syntax for the type lambda [X] => F[X] and F[?] to be the wildcard syntax which unfortunately is different to how the ? is used in kind-projector.
In scala/scala3#5379 there's a discussion of doing the swap incrementally in Scala 3.0 - 3.3, but imo that would lead to unnecessary churn and confusion, so I was wondering if kind-projector could preemptively replace the ? by another symbol so that until Dotty is out the ? is free to use for wildcards.
Maintainers' opinions are welcome here or in the above ticket 😃

@TomasMikula
Copy link
Collaborator

Thank you for letting us know! I think the proposed syntax (F[?] for existential, F[_] for [X] => F[X]) is more intuitive. It will probably be a long and painful transition for projects, but I view it positively overall.

The question for kind projector is, what symbol do we use (alongside ?) in shorthand syntax for type lambdas.

In math, (en-dash) is commonly used for this purpose, as in

Hom(A,–) maps each object X in C to the set of morphisms, Hom(A, X).

The problem is that the en-dash is not a valid Scala identifier. Also, it is not easily typed on a keyboard.

So I suggest to use -- (double minus), which is also the TeX way to typeset an en-dash.

@LukaJCB
Copy link
Member

LukaJCB commented Jan 7, 2019

How about using a star *? I'm not sure if double minus is a great idea, since a single minus already means contravariance.

I think something like Either[Error, *] reads relatively nice.

@SystemFw
Copy link

SystemFw commented Jan 7, 2019

👍 to *

- would read nice, but double minus is not as nice as star I would say.

Agreed on both the pain it will take to translate, and the fact that it's worth it, btw.

@kubukoz
Copy link
Member

kubukoz commented Jan 7, 2019

Let's rename to :D

/s * sounds like a good idea

TomasMikula added a commit to TomasMikula/kind-projector that referenced this issue Feb 21, 2019
Motivation:
There is a proposal for F[?] to denote a wildcard (currently F[_])
in Scala 3.0+ and F[_] to be a shorthand syntax for type lambda
(F[?] with current kind-projector syntax) in Scala 3.3+ (see
scala/scala3#5379).

Supporting an additional placeholder will allow users to gradually move
from `?` to `*` before Scala 3.0 is out.

Resolves typelevel#84.
@TomasMikula
Copy link
Collaborator

See #91 where I went with *.

@non non closed this as completed in #91 Feb 22, 2019
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 a pull request may close this issue.

5 participants