juan_gandhi: (Default)
[personal profile] juan_gandhi
Welcome to Scala 2.12.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions for evaluation. Or try :help.

scala> def f(x: Int) = 10 + x -> "ok"
f: (x: Int)(Int, String)

scala> f(10)
res0: (Int, String) = (20,ok)

scala> def g(x: Int) = 20 + x → "oops"
:11: error: overloaded method value + with alternatives:
  (x: Double)Double 
  (x: Float)Float 
  (x: Long)Long 
  (x: Int)Int 
  (x: Char)Int 
  (x: Short)Int 
  (x: Byte)Int 
  (x: String)String
 cannot be applied to ((Int, String))
       def g(x: Int) = 20 + x → "oops"
                          ^

Date: 2020-05-11 05:18 pm (UTC)
gonchar: (Default)
From: [personal profile] gonchar
Может, шаловливая рука вместо английской Икс начала выводить русское Ха? :)

Date: 2020-05-11 05:32 pm (UTC)
gegmopo4: (Default)
From: [personal profile] gegmopo4
А «->» и «→» идентичны в Скале?

Date: 2020-05-11 06:34 pm (UTC)
spamsink: (Default)
From: [personal profile] spamsink
Явно какая-то copy-paste error в таблице приоритетов.

Странно, что лексер не сводит немедленно -> и → в один токен, иначе как это объяснить?

Date: 2020-05-11 07:37 pm (UTC)
xacid: (Default)
From: [personal profile] xacid
def g(x: Int) = (20 + x) → "oops"

это просто ассоциативность немного хромает :)

а ваще вот что пишут

https://github.com/scala/scala/pull/7540

потомучто https://github.com/scala/bug/issues/11210

таки да, стрелочки всё ...
Edited Date: 2020-05-11 08:00 pm (UTC)

Date: 2020-05-11 11:02 pm (UTC)
jurgen_svoloch: (Default)
From: [personal profile] jurgen_svoloch
Стрелочки?
Ну-ну…

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

July 2025

S M T W T F S
  12345
6789 1011 12
131415 1617 1819
20212223242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 26th, 2025 02:33 am
Powered by Dreamwidth Studios