Ok, I'm working on a programming language. Do think it appropriate to use an init method instead of a constructor?
Point pt = Point.__Init__(x, y);
! OR !
Point pt = Point[x, y];
! OR !
Point pt = Point(x, y);
I like the first one but I'm scared people won't like it. What do you think?
I'm used to the last form.
It would be good if you could add some kind of inference like in C++ (no need to name the constructor) or Vala (no need to declare the type).
By the way, how does the rest of the language looks like?
Previously known as kAlug.
I probably should change the language to the third one. However as far as type inference is concerned. I have decided that is is a statically typed language though it wouldn't hurt to do something like:
Point pt = (x, y); ! This looks the best.
Point pt = [x, y]; ! Blah, current implementation.
Point pt = __Init__(x, y); ! Original design I changed it to: Point.__Init__(x, y);
I changed it because the language has interfaces and inheritance and you may need to access the subclass, for example using the car and vehicle metaphor:
Vehicle car = __Init__(); ! How do you know the Implementation is a car? So I did...
Vehicle car = Car.__Init__();
! But I could always go crazy an allow this...
Vehicle car = __Car__(); ! How about putting the class names between underscores and just use the parenthesis for the parameters?
I'm trying to be a little different and not just do:
Point pt = Point(x,y);
The rest of the language is under wraps for the moment.self.path = path if self.path == None else self.path
!!!I Can't Understand A Bit You Know!!!
PHP5, MySQL, Apache, Ruby, Batch, EXE, CRX (Chrome Extensions), AU3(AutoIT v3), JAVA, JAVAScript, INI, INF, Flash, Visual Basic, C, C++, Turbo C, C#, BASIC, Pascal.