Last active
August 29, 2015 14:24
-
-
Save yitznewton/0e54a901a04e32434df3 to your computer and use it in GitHub Desktop.
PHP structs (hypothetical)
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
| struct Person { | |
| Age $age; | |
| Address $address; | |
| HairColor $hairColor; | |
| Length $height?; // optional? not sure if worth it | |
| } | |
| $yitz = Person( | |
| $age => new Age(30), | |
| $address => $someAddress, | |
| $hairColor => HairColor::BLONDE | |
| ); | |
| echo $yitz->age; | |
| // the output of (new Age(30))->__toString() |
Author
What do you think to this?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The more I look at it, the more the idea of an optional member seems bad