[Dlang-internal] XML support in libphobos
seb at wilzba.ch
Wed Jul 15 16:11:43 UTC 2020
On 15/07/2020 17.39, Carsten Schlote via Dlang-internal wrote:
> there is a definite removal date for std.xml in the docs now:
>> It will be removed from Phobos in 2.101.0.
> Will basic XML support be removed from libphobos entirely?
> Are we forced to use external libraries?
Yes, but you can simply use undead in case you don't want to switch to a
different library (https://github.com/dlang/undeaD).
> We use simple XML code in some D shebang scripts at work. It is a fine
> feature, that we never needed external dependancies, just libphobos.
The same argument can also be made for many other packages on dub
(requests, vibe.d, mir, ...).
Anyhow, it's super simple to switch over to dub as it supports shebang
dependency "undead" version="~>1.1.0"
(code as before)
If you don't want to use dub and want to keep using rdmd, you can
a) drop the undead module in your /usr/include/dlang path
b) add the undead folder via DMD/LDC's config file (dmd.conf or
ldc2.conf) or an environment variable
c) copy the xml module into your script's directory
$ mkdir undead
(xml doesn't depend on other modules of undead at the moment)
However, I do recommend using dub as it's the easiest and most resilient
> Removing the simple but working XML code from libphobos also removes
> some advantages from using D for scripting, IMHO.
Only simple use cases were "working". There were/are tons of problems
with its parser (see e.g. https://issues.dlang.org/show_bug.cgi?id=17709
for an example).
So having a library that silently misparses your documents, can't handle
many use cases, can't handle big files, ..., forces you to use the GC,
is vastly slower than comparable libraries etc. is a worse experience.
For a full reasoning see:
> Having everything essential in libphobos and no external dependancies
> was a great argument for using D vs. using other popular languages and
> alternatives in the past.
No one stops people from bundling snapshots of a few popular dub
packages with a D release (i.e. a "full "batteries included" release)
for user convenience.
More information about the Dlang-internal