{"action":"created","issue":{"url":"https://api.github.com/repos/scala/scala/issues/5350","repository_url":"https://api.github.com/repos/scala/scala","labels_url":"https://api.github.com/repos/scala/scala/issues/5350/labels{/name}","comments_url":"https://api.github.com/repos/scala/scala/issues/5350/comments","events_url":"https://api.github.com/repos/scala/scala/issues/5350/events","html_url":"https://github.com/scala/scala/pull/5350","id":172024516,"number":5350,"title":"Add flag -Ypredef to configure predef objects [ci: last-only]","user":{"login":"andyscott","id":310363,"avatar_url":"https://avatars.githubusercontent.com/u/310363?v=3","gravatar_id":"","url":"https://api.github.com/users/andyscott","html_url":"https://github.com/andyscott","followers_url":"https://api.github.com/users/andyscott/followers","following_url":"https://api.github.com/users/andyscott/following{/other_user}","gists_url":"https://api.github.com/users/andyscott/gists{/gist_id}","starred_url":"https://api.github.com/users/andyscott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyscott/subscriptions","organizations_url":"https://api.github.com/users/andyscott/orgs","repos_url":"https://api.github.com/users/andyscott/repos","events_url":"https://api.github.com/users/andyscott/events{/privacy}","received_events_url":"https://api.github.com/users/andyscott/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/54","html_url":"https://github.com/scala/scala/milestones/WIP","labels_url":"https://api.github.com/repos/scala/scala/milestones/54/labels","id":1643773,"number":54,"title":"WIP","description":"Ongoing work that's not yet ready (experimentation, SIP/SLIP prototyping,..)","creator":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":3,"state":"open","created_at":"2016-03-14T17:42:51Z","updated_at":"2016-10-28T22:51:24Z","due_on":null,"closed_at":null},"comments":22,"created_at":"2016-08-18T23:34:03Z","updated_at":"2016-11-01T16:49:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/5350","html_url":"https://github.com/scala/scala/pull/5350","diff_url":"https://github.com/scala/scala/pull/5350.diff","patch_url":"https://github.com/scala/scala/pull/5350.patch"},"body":"This is a WIP towards adding a `-Ypredef` flag that gives you full control over predefined imports.\n#### Motivation\n\nBy default, scalac imports `java.lang._`, `scala._`, and `scala.Predef._` into the namespace of Scala compilation units.\n\nAs it stands, we have two existing flags that adjust the behavior of predefined imports.\n- `-Yno-imports` disables all of these.\n- `-Yno-predef` disables `scala.Predef._`.\n\nThere are a few other nuances to the behavior of imports. Java compilation units, for example, are unaffected by these flags and always import `java.lang._`. For Scala compilation units, `scala.Predef._` isn't imported when Predef itself is being compiled.\n\nOne piece of functionality that is lacking is the ability to introduce new top level imports. The current approach for this is to write your own predef object and manually import it at the top of each file. This is sometimes used in conjunction with the existing flags.\n#### Changes\n- Added `-Ypredef` which introduces the ability to control which predef objects are used for Scala compilation units. The default value is set to import `java.lang._`, `scala._`, and `scala.Predef._`.\n- Deprecated `-Yno-predef` and `-Yno-imports`.\n- Updated existing multi value settings to support custom delimiters. The new `-Ypredef` flag is configured with `;` as the delimiter so that commas in the import selector syntax don't get mistakenly parsed with splitting the flag's argument list.\n#### Usage\n\n| Value for `-Ypredef:[VALUE]` | Result |\n| --- | --- |\n| `` | No predefined imports. Same behavior as existing flag `-Yno-imports`. |\n| `java.lang._;scala._` | Don't import `scala.Predef._`. This is the same behavior as `-Yno-predef`. |\n| `java.lang._;scala._;scala.Predef._` | Default behavior. |\n| `java.lang._;scala._;com.my.Minidef._` | Imports all of `com.my.Minidef` instead of `scala.Predef` |\n| `scala.Predef.{String=>STRING}` | Imports all of 'scala.Predef.String`as`STRING` |\n\nI'd be great to get any feedback. I would also to back port this to 2.11.\n"},"comment":{"url":"https://api.github.com/repos/scala/scala/issues/comments/257620603","html_url":"https://github.com/scala/scala/pull/5350#issuecomment-257620603","issue_url":"https://api.github.com/repos/scala/scala/issues/5350","id":257620603,"user":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"created_at":"2016-11-01T16:49:06Z","updated_at":"2016-11-01T16:49:06Z","body":"Sounds good, thanks!"}}
{"actor":{"display_login":"adriaanm"}}