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

Deprecate procedure syntax #7605

Closed
scabug opened this Issue Jun 24, 2013 · 8 comments

Comments

Projects
None yet
4 participants
@scabug
Copy link

scabug commented Jun 24, 2013

The special procedure syntax has been a constant source of trouble and confusion for people learning Scala, while providing no benefit except a few saved characters over using the standard method syntax.

To not cause pointless work for people, this migration has to happen in multiple steps:

  • Update the style guide and the specification
  • Update tools (IDEs, Scalariform, ...)
  • Deprecate procedure syntax

Mailing list discussion: https://groups.google.com/d/topic/scala-internals/q1YX7NC1geM/discussion

ScalaDays 2013 Keynote: http://www.parleys.com/play/51c1994ae4b0d38b54f4621b/chapter47

@scabug

This comment has been minimized.

Copy link

scabug commented Jun 24, 2013

@scabug

This comment has been minimized.

Copy link

scabug commented Jun 24, 2013

Tony Sloane (asloane) said:
Just for the record, I'd like to record one vote against removing the procedure syntax.

I may be the only one but I use procedure syntax for situations where I do not intend to return anything, reserving the "normal" syntax for places where a value is returned. I personally find a benefit from having the two different syntaxes to indicate these two situations and I haven't experienced any issues or confusions from having both.

@scabug

This comment has been minimized.

Copy link

scabug commented Jun 25, 2013

@Ichoran said (edited on Jun 25, 2013 12:11:12 AM UTC):
I also vote against removing this syntax.

I find it visually useful (more useful than : Unit = especially when specifying/guaranteeing that there is no return type), it is well-established (and thus a change would affect many lines of code), and even if it is a source of confusion for newcomers it should be quickly dispelled.

@scabug

This comment has been minimized.

Copy link

scabug commented Jun 25, 2013

@soc said:
As mentioned in the thread, nobody claims that experts who know both procedures and methods can't tell them apart.

The issue is that pretty much everyone learning the language falls into the trap of defining a procedure by forgetting the = when they actually intended to define a method.

I don't consider saving 5 characters enough of a reason to expose people learning the language to such a frustrating, unnecessary language detail.

Just a nitpick: The only type which doesn't return anything is Nothing, not Unit (which returns ()). But = is required for Nothing. Yet another reason why I want to get rid of this inconsistency.)

@scabug

This comment has been minimized.

Copy link

scabug commented Jun 25, 2013

Tony Sloane (asloane) said:
I'm certainly not claiming that some beginners don't find this a stumbling point. In my experience of teaching Scala to upper level undergraduates I haven't seen it to be a major problem, certainly not compared to other much trickier things that Scala asks them to learn.

@scabug

This comment has been minimized.

Copy link

scabug commented Oct 23, 2013

@soc said:
PR for the compiler part is scala/scala#3076.

@scabug

This comment has been minimized.

Copy link

scabug commented Dec 11, 2013

@adriaanm said:
Please open separate issues for separate work items. The compiler part is fixed.

@scabug scabug closed this Dec 11, 2013

@scabug scabug added the language spec label Apr 7, 2017

@scabug scabug added this to the 2.11.0-M8 milestone Apr 7, 2017

xuwei-k added a commit to xuwei-k/wandbox-builder that referenced this issue May 20, 2017

xuwei-k added a commit to xuwei-k/wandbox-builder that referenced this issue May 20, 2017

eed3si9n added a commit to eed3si9n/scala that referenced this issue Feb 14, 2018

Deprecate procedure syntax without -Xfuture
Ref scala/bug#7605

scala#3076 deprecated the procedure syntax, but only under -Xfuture flag. This deprecates it without it, and drops it under -Xsource:2.14.
@SethTisue

This comment has been minimized.

Copy link
Member

SethTisue commented Feb 22, 2018

new PR to complete the deprecation and pave the way for eventual removal: scala/scala#6325

eed3si9n added a commit to eed3si9n/scala that referenced this issue Mar 4, 2018

Deprecate procedure syntax without -Xfuture
Ref scala/bug#7605

scala#3076 deprecated the procedure syntax, but only under -Xfuture flag. This deprecates it without it, and drops it under -Xsource:2.14.

xuwei-k added a commit to xuwei-k/play-json that referenced this issue Apr 5, 2018

avoid procedure syntax
procedure syntax is deprecated scala/bug#7605

cchantep added a commit to playframework/play-json that referenced this issue Apr 6, 2018

avoid procedure syntax (#154)
procedure syntax is deprecated scala/bug#7605

adriaanm added a commit to eed3si9n/scala that referenced this issue Apr 10, 2018

Deprecate procedure syntax unconditionally
Procedure syntax was deprecated under -Xfuture flag in scala#3076.
This deprecates it unconditionally, and drops it under -Xsource:2.14.

See scala/bug#7605

adriaanm added a commit to eed3si9n/scala that referenced this issue Apr 10, 2018

Deprecate procedure syntax unconditionally
Procedure syntax was deprecated under -Xfuture flag in scala#3076.
This deprecates it unconditionally, and drops it under -Xsource:2.14.

See scala/bug#7605

adriaanm added a commit to eed3si9n/scala that referenced this issue Apr 10, 2018

Deprecate procedure syntax unconditionally
Procedure syntax was deprecated under -Xfuture flag in scala#3076.
This deprecates it unconditionally, and drops it under -Xsource:2.14.

See scala/bug#7605

adriaanm added a commit to eed3si9n/scala that referenced this issue Apr 11, 2018

Deprecate procedure syntax unconditionally
Procedure syntax was deprecated under -Xfuture flag in scala#3076.
This deprecates it unconditionally, and drops it under -Xsource:2.14.

See scala/bug#7605

eed3si9n added a commit to eed3si9n/scala that referenced this issue Apr 24, 2018

Deprecate procedure syntax unconditionally
Procedure syntax was deprecated under -Xfuture flag in scala#3076.
This deprecates it unconditionally, and drops it under -Xsource:2.14.

See scala/bug#7605

eed3si9n added a commit to eed3si9n/scala that referenced this issue Apr 25, 2018

Deprecate procedure syntax unconditionally
Procedure syntax was deprecated under -Xfuture flag in scala#3076.
This deprecates it unconditionally, and drops it under -Xsource:2.14.
See scala/bug#7605

To update the tests, this drops procedure syntax from test/ using ScalaFix

```
$ coursier launch ch.epfl.scala:scalafix-cli_2.12.3:0.5.3 -- -r ProcedureSyntax test
$ coursier launch ch.epfl.scala:scalafix-cli_2.12.4:0.5.10 -- -r ExplicitUnit test
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment