Is AliasAssign Now Official?

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Fri Aug 20 06:33:13 UTC 2021


On Thursday, 19 August 2021 at 21:01:14 UTC, max haughton wrote:
> What other alternative is there? The existing interpreter is 
> fundamentally slow, but there aren't many alternatives to 
> roughly what Stefan was trying to

I've always wondered, what was the problem to use ast as bytecode 
instead of actual bytecode. I.e. have an interpreter that puts 
the results on a stack, and all allocations done on a special 
region of heap, and then drop them as soon as the result is 
available, or is this how const folder/ctfe works now?

>
> The issue is that parts of dmd are written with absolutely no 
> concept of a big picture whatsoever and dependency resolution 
> is done like a chimp let loose in an operating theatre. Writing 
> something like newCTFE should not be that hard (You can write a 
> bytecode interpreter in literally half a day, and translate an 
> AST to that byte in another day - a week if you want test 
> coverage), but as far as I can tell you end up with horrific 
> problems because the "interpreter" is not an interpreter as per 
> se but rather a glorified constant-folding step - i.e. things 
> are still being resolved as the folding (all this wrapped in an 
> awful interface, too! e.g. `null` can mean all kinds of things 
> inside dmd - like not resolved, couldn't resolve, not present, 
> haven't tried yet etc. in the same place) so what should be a 
> simple task ends up going from balancing a stick to balancing 
> an n-pendulum on your nose.
>
> https://youtu.be/cyN-CRNrb3E

You're saying the exact thing I said, compiler isn't ready for a 
vm that works on bytecode. Also apparently a bytecode and vm for 
a simple calculator could be written in half day, not for a more 
complex language, per my observations of reports done during new 
ctfe development.

> newCTFE also isn't dead, as far as I know it's blocked on 
> something like exceptions - although I wouldn't call it exactly 
> alive either.

So it is a zombie. I hope at least some parts of this zombie 
could've been merged into dmd, not necessarily something that 
improves ctfe.

> but equally who else is doing anything else even remotely 
> interesting? Since 2017 we've gained, what, static foreach? 
> Innovation is hard, the state of our existing stuff isn't 
> helping.

Well that means that existing stuff needs to be improved so 
innovation can go, otherwise it would be the case that for a 
single change entire compiler would need to be modified (if going 
to edge).

> Simple guideline for future big (>10 commits) projects for D: 
> They *must* be developed either in an official fork or in a 
> branch in an official project, otherwise they'll wither and die 
> without being seen by enough eyes.

Or just by being public, and referenced on forums, so anyone can 
fork and contribute to it.

Regards,
Alexandru.




More information about the Digitalmars-d mailing list