Bypassing the postblit?

monarch_dodra monarchdodra at gmail.com
Mon Dec 30 05:14:37 PST 2013


On Monday, 30 December 2013 at 11:42:52 UTC, Ritu wrote:
>
>> As I already said, the solution is another level of 
>> indirection.
>
> Well, I do not have a possibility of another level of 
> indirection. I am working on a DSL embedded in D. My biggest 
> gripe with D is that it does not let me create a struct that 
> gives the end user a feeling of native data type. But on the 
> other hand we have a lot of capabilities that other languages 
> do not have. I believe presently D is the best systems 
> programming language to build a DSL in, but it can be easily 
> made much better.
>
> I do not know how to impress Andrei and Walter. I do not even 
> know if they are reading this thread.
>
> Regards
> - Ritu

What's wrong with "pre-"initializing your data? Surely, there are 
other ways to workaround your problem then having a "2-arg 
postblit". C++ allows CC with a mutable arg. It's been used 
*once* (AFAIK) for auto_ptr, and *that* was deemed a complete 
failure.

There might be usecases were it is legitimately useful, but not 
enough to warrant such a language change.

Have you tried any of the two solution I told you about? "static 
opCall" emulates a default constructor pretty well.

Another solution is simply... pass by ref?


More information about the Digitalmars-d mailing list