News for hackers. Stuff that matters.
Re:The Future of Standard ML (2013) [pdf] by jxy on Thursday July 14, 2016 @03:43PM (#12096666)

  > operators (not named functions) are to programming
  > languages as icon-only buttons are to web pages;
  > they are completely unusable.
I see ( ) ; . you are using already. Latin letters are gibberish to people who don't use it.
Re:The Future of Standard ML (2013) [pdf] by rvense on Thursday July 14, 2016 @03:57PM (#12096761)
I wrote some Scala just today:

  val list = a +: l :+ b
And I knew I had to put in a comment because that stuff always makes my eyes cross over when I come back to it.
Re:The Future of Standard ML (2013) [pdf] by talideon on Thursday July 14, 2016 @08:34PM (#12098250)
Don't know Scala, but I'd assume that `+:` is prepend to list and `:+` is append to list.
Re:The Future of Standard ML (2013) [pdf] by rvense on Thursday July 14, 2016 @08:43PM (#12098278)
You'd be correct.

But they're just method calls, both defined on the class of l. It is a little weird.

Re:The Future of Standard ML (2013) [pdf] by jfb on Thursday July 14, 2016 @08:55PM (#12098326)
I can see the argument for terseness in source, particularly in domains where the terseness in code reflects well-understood shorthand in the actual problem space. But stuff like that makes me itch, to be honest.
Re:The Future of Standard ML (2013) [pdf] by rvense on Thursday July 14, 2016 @09:24PM (#12098419)
The alternative would be something like

  l.prepend(a).append(b)
Horrible. Ghastly. Can't see anybody tolerating a language that looked like that.. /s
Re:The Future of Standard ML (2013) [pdf] by yawaramin on Thursday July 14, 2016 @10:19PM (#12098590)
It gets even worse. Because Scala has infix syntax for method calls, you can do

    l prepend a append b
Re:The Future of Standard ML (2013) [pdf] by jfb on Thursday July 14, 2016 @09:45PM (#12098483)
What? Mutating a list? DISGUSTING!
Re:The Future of Standard ML (2013) [pdf] by speedkills on Thursday July 14, 2016 @10:33PM (#12098633)
It's not mutating, its returning a new list with elements prepended and appended.
Re:The Future of Standard ML (2013) [pdf] by snoman on Friday July 15, 2016 @02:12AM (#12099222)
Don't know Scala but why wouldn't it be

a.append(l).append(b)

?

Re:The Future of Standard ML (2013) [pdf] by rvense on Friday July 15, 2016 @06:00AM (#12099860)
That would only work if a was itself a list..
Re:The Future of Standard ML (2013) [pdf] by jxy on Thursday July 14, 2016 @06:50PM (#12097782)

  もっと練習  ⍝ Practice more  NB. ⍝ is a symbol for comment.
  /* NB. is for comment, too. */
  // Anything inside /* */ is comment, too.
  #  // starts a comment, too.
Re:The Future of Standard ML (2013) [pdf] by pmontra on Thursday July 14, 2016 @05:25PM (#12097283)
I don't know Scala and I have no idea of what +: :+ means, which at first is not a good sign (think about onboarding.) Then I remembered that many mainstream languages have the

    a ? b : c
construct which maybe was equally puzzling when it was introduced by CPL in 1963.
Re:The Future of Standard ML (2013) [pdf] by rvense on Thursday July 14, 2016 @08:42PM (#12098275)
They're operators that cons an element on to a list. They're both defined on the List class, but differ in associativity because they start/end in a colon.

"a +: l" calls the +: method on l with a as its argument and returns a list with a added to the start, "l :+ b" calls the :+ method on l with b as its argument and returns a list with b added to the end. "a +: l :+ b" (parsed as "(a +: l) :+ b") therefore returns a copy of l with a added to the start and b added to the end.

This is user definable, you can make operators whichever way you like (and start them with : if you want them to be right associative).

It's very flexible and you do sort of get used to libraries using it, but I'm not entirely sure that getting used to something always means it's good.

(TBH though, I use the ternary operator constantly and think nothing of it.)

Re:The Future of Standard ML (2013) [pdf] by billrobertson42 on Thursday July 14, 2016 @06:55PM (#12097807)
Scala can be extended by users with stuff like that.
Re:The Future of Standard ML (2013) [pdf] by pekk on Thursday July 14, 2016 @08:33PM (#12098245)
The fact that C-style ternary is hard to pick up doesn't really excuse this kind of thing in new languages.