Ah .. getting off the boat may have been useful. Any opinions on replacing "class" with "concept"?
A note on this: at present you can NOT make a Felix object on the heap. You can do this: var px = new 1; but that does not make an object on the heap, it makes an object on the stack and *copies* it onto the heap. Probably equivalent but not efficient. However there is a case where it is not possible: when the underlying object is uncopyable. To solve this problem, Felix has a second kind of new: "class new". This is the same as C++ new: it constructs an object on the heap. "Class new" is implemented in the code generator and other places, and has been for ages. The arguments are not type checked however. However you cannot invoke class new in Felix even though the compiler supports it .. for the trivial reason I couldn't think of a suitable syntax! Because the obvious syntax is new class X(arguments) and that meaning of class conflicts with type classes. It won't if we rename them "concept" :-) This also means we need to declare the constructor types. Again we cannot use "ctor" because that's already used. In fact Felix "ctor"s are NOT constructors! They're actually conversion operators. There's a major difference, similar to union "constructors" not being functions. In fact a union constructor union X = | C of int has kind TYPE -> TYPE That is, its a functor, not a function (functions just have kind TYPE). Similarly, class constructors are like "solo" union constructors. for example complex (1.0,2.0) in C++ is a value, and here "complex" constructor is NOT a function. Even in C++ it is NOT a function no matter what ignorant C++ programmers think, no matter what the Standard says, constructors are NOT functions. Constructors do NOT return values, they're actually procedures. They convert TYPE -> TYPE for example byte ^ (2 * sizeof double) |-> complex i.e. they initialise store that formerly was a byte array and becomes a complex number. They don't return anything. So perhaps we can now say: cclass complex { ctor : double * double; .... } to create a binding, and here "ctor" actually means a constructor. Now you can say px = new class complex (1.0,2.0) and it is type checked, and returns a pointer to the heap. The implementation in C++ is of course: new complex (1.0, 2.0) or perhaps new (gc, complex_shape) complex (1.0, 2.0); We might also now allow class FelixClass { .... } if I can figure out how to bind methods. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language