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

Deprecate procedure syntax #7605

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

Deprecate procedure syntax #7605

scabug opened this issue Jun 24, 2013 · 8 comments
Assignees
Milestone

Comments

@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
Copy link
Author

scabug commented Jun 24, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7605?orig=1
Reporter: @soc
See #7523, #7648, #6811

@scabug
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

scabug commented Oct 23, 2013

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

@scabug
Copy link
Author

scabug commented Dec 11, 2013

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

@scabug scabug closed this as completed Dec 11, 2013
@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
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
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
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
procedure syntax is deprecated scala/bug#7605
cchantep pushed a commit to playframework/play-json that referenced this issue Apr 6, 2018
procedure syntax is deprecated scala/bug#7605
adriaanm pushed a commit to eed3si9n/scala that referenced this issue Apr 10, 2018
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 pushed a commit to eed3si9n/scala that referenced this issue Apr 10, 2018
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 pushed a commit to eed3si9n/scala that referenced this issue Apr 10, 2018
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 pushed a commit to eed3si9n/scala that referenced this issue Apr 11, 2018
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
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
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
```
HyukjinKwon pushed a commit to apache/spark that referenced this issue Aug 9, 2023
### What changes were proposed in this pull request?

The scala sample code in the quick-start chapter was using deprecated syntax, so this PR has fixed it.

### Why are the changes needed?

procedure syntax (SI-7605) is now deprecated, and some editors or IDEs warn against this code.
scala/bug#7605

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

`SKIP_API=1 bundle exec jekyll build` on local.

Closes #42400 from mox692/deprecate_procedure_syntax.

Authored-by: mox692 <moymoymox@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
valentinp17 pushed a commit to valentinp17/spark that referenced this issue Aug 24, 2023
### What changes were proposed in this pull request?

The scala sample code in the quick-start chapter was using deprecated syntax, so this PR has fixed it.

### Why are the changes needed?

procedure syntax (SI-7605) is now deprecated, and some editors or IDEs warn against this code.
scala/bug#7605

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

`SKIP_API=1 bundle exec jekyll build` on local.

Closes apache#42400 from mox692/deprecate_procedure_syntax.

Authored-by: mox692 <moymoymox@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
ragnarok56 pushed a commit to ragnarok56/spark that referenced this issue Mar 2, 2024
### What changes were proposed in this pull request?

The scala sample code in the quick-start chapter was using deprecated syntax, so this PR has fixed it.

### Why are the changes needed?

procedure syntax (SI-7605) is now deprecated, and some editors or IDEs warn against this code.
scala/bug#7605

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

`SKIP_API=1 bundle exec jekyll build` on local.

Closes apache#42400 from mox692/deprecate_procedure_syntax.

Authored-by: mox692 <moymoymox@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants