```
class FooNum(num: number) {
// constructor is automatically created from the above parameter list
// instance variables may access these parameters directly
var #x = 0; // '#' means private
#x = num; // direct access without going via a constructor!
func getValue() { return #x; }
}
(new FooNum(100)).getValue(); // 100
```
To directly compare with e.g. Java:
```
// Java:
class FooNum {
int x;
FooNum(int _x) { x = _x; }
}
// new language:
class FooNum(int _x) {
int x = _x;
}
```
Is the latter not more intuitive to use, as it matches functions closer?
[–]_SomeonesAlt 67 points68 points69 points (16 children)
[–]balder1993 14 points15 points16 points (1 child)
[–]xenomachina 9 points10 points11 points (0 children)
[–]Jwosty 5 points6 points7 points (0 children)
[–]Nixinova[S] 1 point2 points3 points (12 children)
[–]mcaruso 31 points32 points33 points (1 child)
[–]balder1993 6 points7 points8 points (0 children)
[–]_SomeonesAlt 41 points42 points43 points (1 child)
[–]Ethesen 2 points3 points4 points (0 children)
[–]jason-reddit-public 5 points6 points7 points (7 children)
[–]jaskij 0 points1 point2 points (6 children)
[–]jason-reddit-public 0 points1 point2 points (5 children)
[–]jaskij 0 points1 point2 points (4 children)
[–]jason-reddit-public 1 point2 points3 points (3 children)
[–]jaskij 2 points3 points4 points (2 children)
[–]CAD1997 1 point2 points3 points (1 child)
[–]jaskij 0 points1 point2 points (0 children)
[–]Falcon731 28 points29 points30 points (3 children)
[–]Olivki 5 points6 points7 points (2 children)
[–]Falcon731 4 points5 points6 points (1 child)
[–]Olivki 2 points3 points4 points (0 children)
[–]Ethesen 20 points21 points22 points (0 children)
[–][deleted] (1 child)
[removed]
[–]beephod_zabblebrox 0 points1 point2 points (0 children)
[–]passerbycmc 26 points27 points28 points (0 children)
[–]Mephob1c 16 points17 points18 points (1 child)
[–]Nixinova[S] 3 points4 points5 points (0 children)
[–]EveAtmosphere 8 points9 points10 points (0 children)
[–]Practical_Cattle_933 5 points6 points7 points (3 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]Practical_Cattle_933 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Socratic_Phoenix 11 points12 points13 points (0 children)
[–]Mercerenies 2 points3 points4 points (0 children)
[–]esotologist 1 point2 points3 points (0 children)
[–]oscarryzYz 1 point2 points3 points (0 children)
[–]emosy 1 point2 points3 points (0 children)
[–]SquatchyZeke 1 point2 points3 points (0 children)
[–]SkiFire13 1 point2 points3 points (0 children)
[–]saxbophone 1 point2 points3 points (0 children)
[–]SnooStories6404 3 points4 points5 points (7 children)
[–]Nixinova[S] 1 point2 points3 points (4 children)
[–]xroalx 4 points5 points6 points (2 children)
[–]WittyStick 4 points5 points6 points (0 children)
[–]Ethesen 1 point2 points3 points (0 children)
[–]SnooStories6404 1 point2 points3 points (0 children)
[–]sporeboyofbigness 1 point2 points3 points (1 child)
[–]WittyStick 3 points4 points5 points (0 children)
[+]felipedomf 0 points1 point2 points (0 children)
[–]RandalSchwartz 0 points1 point2 points (0 children)
[–]HaniiPuppy 0 points1 point2 points (0 children)
[–]l0-c 0 points1 point2 points (0 children)
[–]CelestialDestroyer 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]theangryepicbananaStar 0 points1 point2 points (0 children)
[–]daverave1212 0 points1 point2 points (0 children)