Created
May 8, 2018 22:00
-
-
Save yshui/c6692ba1570c828ca35f57db170ed9ba to your computer and use it in GitHub Desktop.
Idea
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //fun(T)(ref immutable T a){ | |
| // //If T is a struct, and I only use immutable fields of T | |
| // //then it should be ok to call fun with a partially mutable type | |
| //} | |
| void f(T: class)(immutable T a) { | |
| return a.x+1; | |
| } | |
| void main() { | |
| class A { | |
| immutable int x = 10; | |
| double f; | |
| } | |
| auto x = new A; | |
| f(x); // <- fine | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment