August 13

On Monday, 12 August 2024 at 15:23:31 UTC, Stefan Koch wrote:

>

It's about 12.000 lines of code.
I am not sure how much has rotted away, I last touched it in 2021.

The relevant files would be:
the bytecode interpreter:
https://github.com/UplinkCoder/dmd/blob/newCTFE_2093/src/dmd/ctfe/bc.d
the visitor that builds the bytodecode:
https://github.com/UplinkCoder/dmd/blob/newCTFE_2093/src/dmd/ctfe/ctfe_bc.d

as you can see by the branch name it was rebased on dmd 2.093.
so that's a few versions old now.

My word! I wonder how difficult it would be to maintain that if it actually got merged into dmd. Do you remember what parts of it were left unfinished?

>

As far as I know Max Haughton has tried to rebase it on master and improve it but I have not heard from him about that.

I won’t get my hopes up for one person to rebase 12k lines through 14.5K commits. It’s simply not feasible. I think a larger community effort would be required to successfully resurrect this implementation; although I am perhaps foolhardy enough to try it myself…

August 14

I've been using patterns such as this with no difficulty. ctfe+mixins == it just works.
I don't know if there's some character limit where eventually the ctfe string return will give up, but for moderate programs it seems fine.

// Copy fields from another struct, wrapping non-primary key elements in Nullable!T
private static string UpdaterFields(STRUCT)() {
	string[] s;
	static foreach (idx, field; STRUCT.tupleof) {{
		enum NAME = field.stringof;
		enum bool isPrimary = hasUDA!(field, PRIMARY);
		static if (isPrimary) {
			enum typestr = format("typeof(STRUCT.%s)", NAME);
		} else {
			enum typestr = format("Nullable!(typeof(STRUCT.%s))", NAME);
		}
		string[] udas;
		static foreach (uda; __traits(getAttributes, field)) {
			udas ~= "@("~uda.stringof~")";
		}
		auto udastr = udas.length ? udas.join(" ")~" " : "";
		s ~= format("%s%s %s;", udastr, typestr, NAME);
	}}
	return s.join("\n");
}
pragma(msg, UpdaterFields!STRUCT);
mixin(UpdaterFields!STRUCT);
August 16

On Tuesday, 13 August 2024 at 19:40:30 UTC, IchorDev wrote:

>

On Monday, 12 August 2024 at 15:23:31 UTC, Stefan Koch wrote:

>

It's about 12.000 lines of code.
I am not sure how much has rotted away, I last touched it in 2021.

The relevant files would be:
the bytecode interpreter:
https://github.com/UplinkCoder/dmd/blob/newCTFE_2093/src/dmd/ctfe/bc.d
the visitor that builds the bytodecode:
https://github.com/UplinkCoder/dmd/blob/newCTFE_2093/src/dmd/ctfe/ctfe_bc.d

as you can see by the branch name it was rebased on dmd 2.093.
so that's a few versions old now.

My word! I wonder how difficult it would be to maintain that if it actually got merged into dmd. Do you remember what parts of it were left unfinished?

I do not know on the top of my head.
I remember some math was not interpreted correctly.
Though after I stopped working with D I never went back to look.

> >

As far as I know Max Haughton has tried to rebase it on master and improve it but I have not heard from him about that.

I won’t get my hopes up for one person to rebase 12k lines through 14.5K commits. It’s simply not feasible. I think a larger community effort would be required to successfully resurrect this implementation; although I am perhaps foolhardy enough to try it myself…

The code is rather self contained.
I usually don't rebase but I simply copy the files from the ctfe directory into the master checkout do what I can to make it compile and then commit them as new files.
The history has been lost a long time ago already.

The only change to existing files should be in dinterpret.d where I hook myself into the existing evaluator.

1 2 3
Next ›   Last »