Regarding hex strings
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Sat Oct 20 14:03:23 PDT 2012
On Fri, 19 Oct 2012 15:07:09 +0200
"foobar" <foo at bar.com> wrote:
> On Friday, 19 October 2012 at 00:14:18 UTC, Nick Sabalausky wrote:
> > On Thu, 18 Oct 2012 12:11:13 +0200
> > "foobar" <foo at bar.com> wrote:
> >>
> >> How often large binary blobs are literally spelled in the
> >> source code (as opposed to just being read from a file)?
> >
> >
> > Frequency isn't the issue. The issues are "*Is* it ever
> > needed?" and
> > "When it is needed, is it useful enough?" The answer to both is
> > most
> > certainly "yes". (Remember, D is supposed to usable as a systems
> > language, it's not merely a high-level-app-only language.)
>
> Any real-world use cases to support this claim?
I've used it. And Denis just posted an example of where it was used to
make code far more readable.
> Does C++ have such a feature?
It does not. As one consequence off the top of my head, including binary
data into GBA homebrew became more of an awkward bloated mess than it
needed to be.
> My limited experience with kernels is that this feature is not
> needed.
"I haven't needed it" isn't remotely sufficient to demonstrate that
something doesn't "pull it's own weight".
> The solution we used for this was to define an extern
> symbol and load it with a linker script (the binary data was of
> course stored in separate files).
>
Yuck!
s/solution/workaround/
> >
> > Keep in mind, the question "Does it pull it's own weight?" is
> > for
> > adding new features, not for going around gutting the language
> > just because we can.
>
> Ok, I grant you that but remember that the whole thread started
> because the feature _doesn't_ work so lets rephrase - is it worth
> the effort to fix this feature?
>
The only bug is that it tries to validate it as UTF contrary to the
spec. Making it *not* try to validate it sounds like a very minor
effort. I think you're blowing it out of proportion.
And yes, I think it's definitely worth it.
> >
> >> In any case, I'm not opposed to such a utility library, in
> >> fact I think it's a rather good idea and we already have a
> >> precedent with "oct!"
> >> I just don't think this belongs as a built-in feature in the
> >> language.
> >
> > I think monarch_dodra's test proves that it definitely needs to
> > be
> > built-in.
>
> It proves that DMD has bugs that should be fixed, nothing more.
Right so let's jettison x"..." just because *someday* CTFE might become
good enough that we can bring the feature back. How does that make
any sense?
We already have it, it basically works (aside from only a fairly
trivial issue). *When* CTFE is good enough to replace it, *then* we can
have a sane debate about actually doing so. Until then, "Let's get
rid of x"..." because it can be done in the library" is a pointless
argument because at least for now it's NOT TRUE.
More information about the Digitalmars-d
mailing list