-
Notifications
You must be signed in to change notification settings - Fork 30
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
SIP-65: Generic Number Literals #85
base: main
Are you sure you want to change the base?
Conversation
my comments re the implementation: scala/scala3#7468 |
|
@bishabosha I think this concern is made obsolete by implicit conversions being removed. |
Well they aren't removed yet 😅 |
I meant going to be removed. |
@soronpo I think the tension is around the concept of target typing (not unrelated to the discussion on relative scoping for hierarchical ADT arguments BTW). The current generic number literals proposal relies heavily on it. In consequence, it has limited power, as outlined for instance by @sjrd in the generic number literals pull request. Besides, it could be covered by existing string interpolation: bi"10_000_000_000" , for which your proposal is just an improvement: big#345463489989893859438943643 . But the current proposal would allow a constructor based, quote less syntax that suits my own use case (computer algebra) quite well: BigInteger(345463489989893859438943643) , as long as I can define said constructor as follows: object BigInteger:
def apply(x: BigInteger) = x . Here we have an expected type |
Not always. Only when there is an explicit destination type. Implicit conversions or type-classes are not applicable. Huge blocker IMHO. |
My destination type is |
I understand your use case. The motivation for the feature is lacking since it does not cover the situations where the destination type is not |
And if truly the only relevant use-case is big literals, I would opt for a Big Literal SIP instead of the generic numeric literals that are not really generic enough. |
Right, regarding That said, as explained elsewhere, in the context of my project, my strategy is to do without |
To summarize, to be able to move forward with this proposal please:
|
Regarding the object MyBigInt:
def apply(x: BigInt) = x But again, adding a constructor is just to address the shortcomings of target typing, and the main use case of writing big numbers as, like, numbers, is still relevant and well worth de-experimental-ifying the feature (as-is). WDYT? val x: BigInt = 111111100000022222222222 |
No description provided.