Super-dee-duper D features

Bill Baxter dnewsgroup at billbaxter.com
Wed Feb 14 11:53:08 PST 2007


Nicolai Waniek wrote:
> janderson wrote:
>> What about using it for files that you are going to load at runtime
>> otherwise? XML ect...?
>>
>> -Joel
> 
> Loading the file belongs to runtime. Well, if it would take 10 minutes
> to load the file instead of 1 second if it was "loaded during
> compilation", that would be an argument for something like that - but I
> guess this won't be the case in most projects.
> 
> With your example: If you define something like that for compile time,
> it won't make it possible to change this dynamically, e.g. with a
> configuration file. 

Maybe that's exactly the point.  You want configuration files that are 
easy to work with for developers, but you do not want end-users mucking 
with them.  Or small scripts that are part of a game engine.  You may 
want them loaded at runtime during development for easy modification, 
but when you ship your game you may prefer to have that script code 
embedded in the .exe where users can't muck with it.

Another case is where you want to have an all-in-one .exe with a tidy 
install.  If you have external configuration files then you have to 
worry about finding them at runtime and handling the case when you can't 
find them for whatever reason.  Easier to just embed and be done with it.

I don't think loading data files is a one-size-fits-all issue. 
Sometimes it makes sense to embed.

On the other hand, that doesn't mean you need import to do it.  You can 
always write an external tool too 'stringify' a data file.  In fact 
that's exactly what I did: 
http://www.dsource.org/projects/luigi/browser/trunk/luigi/wrapres.d

The new import makes much (but not all) of the functionality of that 
converter unnecessary.

--bb



More information about the Digitalmars-d mailing list