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

Allow ← and → as well as ⇒ #988

Closed
scabug opened this issue May 31, 2008 · 13 comments
Closed

Allow ← and → as well as ⇒ #988

scabug opened this issue May 31, 2008 · 13 comments
Milestone

Comments

@scabug
Copy link

@scabug scabug commented May 31, 2008

How very exciting! Scala is the first language I’ve programmed in which has a Unicode character, ⇒, as one of the built-in language operators!

However, in ‘for’ statements, one must still use primitively-constructed ASCII arrows, as in for(v <- blah) stuff. Please can you allow for(v ← blah) stuff.

Also, for writing pairs, key → value would be nice.

Thank you very much.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 31, 2008

Imported From: https://issues.scala-lang.org/browse/SI-988?orig=1
Reporter: andrewf
Assignee: Geoffrey Alan Washburn (washburn)

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 1, 2008

Geoffrey Alan Washburn (washburn) said:
This is an easy and sensible change, but the implications for backwards compatibility are not clear. As such maybe this should be introduced in a SIP.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 2, 2008

@lexspoon said:
Using Unicode characters looks like more trouble than advantage. As soon as you use non-ASCII characters, you create places where Scala code cannot work. For example, copy-pasting Scala code between applications becomes unreliable. Also, even with Unicode-enabled apps, you do not always have the correct fonts available. Even when you do, they do not always mesh nicely with the other fonts you are using.

These problems are real productivity killers when they crop up, thus outweighing the advantages of having nice-looking glyphs. In addition, there is nothing stopping an IDE from displaying Scala code using nicer glyphs....

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 2, 2008

Geoffrey Alan Washburn (washburn) said:
Those sound like problems with your software and fonts, not with supporting Unicode.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 2, 2008

@lexspoon said:
I don't see how which software is at blame changes anything in my argument. Non-ASCII characters are productivity land mines, and the precise reasons aren't important. We shouldn't encourage a known productivity killer unless we can identify a significant benefit. Looking marginally nicer does not seem like enough to me, because there are other ways to achieve a nicer look.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 2, 2008

Geoffrey Alan Washburn (washburn) said:
I don't think anything is going to be solved by saying Unicode is just "bad" and that the future is using non-standardized sequences of ASCII symbols that have no portable meaning. ← is always going to be a left pointing arrow, whereas <- could be any number of things.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 2, 2008

@dragos said:
I thought the proposal is to accept both. We already do it for =>, and no one complained so far. Then why not be consistent, and allow the same flexibility for both kinds of arrows?

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 2, 2008

@lexspoon said:
Geoff, I actually think Unicode is pretty good. My objection is that we should minimize the dependencies users face. I shudder to think of someone posting pretty Scala code in a blog, readers copy pasting it, and the resulting code failing to compile. What do you make of that scenario?

Iulian, I agree except that I suspect too few people use the Unicode right arrow for us to really draw conclusions. Do you know of any uses in the wild? I bet if we checked some right arrows into the compiler repository, most people wouldn't notice, but an occasional person would get stuck when their svn chose UTF-8 but their scalac chose Latin-1.

In fact, if there are a lot of people tempted to add more Unicode support, how about we start with just that experiment? Check in a Unicode right arrow and then see if anyone gets tripped up by it. If after a few months not a person has been tripped up, then I retract my objection. If someone does complain, though, we would have evidence that even the existing right arrow support should be deprecated.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 2, 2008

andrewf said:
Crickey, I seem to have started a robust discussion here. As the original reporter, can I say that personally I have been using the \u21D2 double arrow in my code, and it makes a small, though pleasant improvement to the readability— especially since it’s quite a common Scala operator. If I had the option (again for readability), I’d be tempted to use ≤, ≥, ≠ in my code too. I have been known to define π = 3.14159 on occasion…

IDEs could choose to display => as ⇒ but you know that they probably won’t. Or at least, the ones everybody uses won’t.

Some people might have problems when checking out and trying to compile Unicode, under some circumstances. For public code bases (like the Scala runtime libraries), I’d understand (and even support) an ASCII-only rule… But it seems odd to banish the opportunity to use the ‘right’ character for the right purpose just because a lot of tools and systems still don’t have seamless Unicode support yet. Mine does and I’d like to make use of it!

By the same token, French, Norwegian and Japanese are able to use their native characters in identifiers. You might as well stop them doing so on the basis that it creates potential portability problems.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 10, 2008

Geoffrey Alan Washburn (washburn) said:
Done in r15327.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 12, 2008

Andrew Foggin (andyfoggin) said:
Small point I know ;) but \u2190 (<) needs to be added to the language specification as a reserved word (as is already done for \u21D2 (=>))

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 12, 2008

Geoffrey Alan Washburn (washburn) said:
Documentation is updated too, but I can't figure out how to build that. I guess someone can do that next time the website is updated.

@scabug scabug closed this May 18, 2011
@scabug scabug added this to the 2.7.2 milestone Apr 6, 2017
@SethTisue

This comment has been minimized.

Copy link
Member

@SethTisue SethTisue commented May 16, 2019

the unicode arrows are deprecated in Scala 2.13 (as per scala/scala#7540)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.