D scripting in D

Mike B Johnson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 2 13:47:31 PDT 2017


On Friday, 2 June 2017 at 15:55:53 UTC, Lewis wrote:
> On Friday, 2 June 2017 at 02:06:27 UTC, Mike B Johnson wrote:
>> I wonder if it is possible to somehow turn D in to a scripting 
>> language that can be run inside D?
>
> On a game project I'm working on at home, I've done:
>
> - Hot reloading via a DLL
> - A build script that runs in the background, detects file 
> changes, and automatically rebuilds
> - A code structure that keeps build times to a minimum 
> (currently 1.8s)
>
> All these combined, and D feels pretty script-like. The setup 
> is far from ideal, since it imposes some limitations on the 
> language (only limited use of classes/finalizers, be careful 
> with static data, some changes to the program state struct 
> require a restart, etc). It also took a significant amount of 
> work to get it up and running, requiring several changes to 
> druntime.
>
> But writing an entire feature with the game still running, 
> followed by testing and iterating, all without closing the 
> game, is pretty great. Way nicer than at work, where I have 
> 1-15 minute rebuilds, with a restart for every change.

Would you mind, when you get some time, to write up a more 
detailed analysis of the problems you had to overcome to get it 
to work? Possibly we could get some type of library solution that 
just "works" with very little change and restriction?

After all, dll's effectively already solve the problem, in some 
sense... except they are generally not meant to be reloaded on 
demand. Solving the issues that reloading causes, I think, would 
be the bulk of the problem?


More information about the Digitalmars-d-learn mailing list