Results 109 comments of Piotr Fusik

Returning an object storage, in general, implies making a copy of the object. Java doesn't support that. Factory methods should make a heap allocation: ```csharp public static Length# Create(double value,...

If I understand correctly, you are asking for moving objects: ```csharp static Length() Create() { Length() localObj; return localObj; // OK because localObj is about to be destroyed } Length()...

> do you want the structs to be opaque to discourage people from messing with the internal data? Explicit structures become part of the library interface. This is especially important...

Yes, there's inconsistency between the generated C and C++ code: * C uses opaque pointers and only allows the users to allocate on the heap. That felt the right way,...

> Is there not any kind of compiler/linker flag to automatically generate Pimpl for classes that will be exported in a DLL? No. I only found: * a [code generator](https://github.com/blockspacer/flex_pimpl_plugin),...

Back to the original problem. The argument of best performance in C and C++ is important. I think I can tolerate the two drawbacks mentioned above. Consider: ```csharp class Vector3D...

Users messing with fields directly isn't a problem for `Vector3D` either. This can even be viewed as a feature.

Added initial implementation. It has no diagnostics to prevent you from accidentally making a copy, so use with care! There are rough edges for the C target: - invalid C...

> invalid C emitted if a returned object is passed as a pointer argument Fixed last week. See https://github.com/pfusik/ray-ci for a small sample. It exposed a new problem: if you...

> I guess I was assuming a return by value in Cito could be converted to a return by value in C/C++, but converted to a return by reference in...