On C/C++ undefined behaviours
Walter Bright
newshound2 at digitalmars.com
Fri Aug 20 23:09:25 PDT 2010
Nick Sabalausky wrote:
> "Walter Bright" <newshound2 at digitalmars.com> wrote in message
> news:i4nn6k$sos$2 at digitalmars.com...
>> SK wrote:
>>> Do you mean to say:
>>> Instead of shipping the intermediate code, always ship source code.
>> Yes.
>>
>>> -or-
>>> Instead of caching the binary, just cache the source code.
>>>
>>> Neither of those guesses make general sense so I'm afraid I miss your
>>> point.
>> Why doesn't it make sense?
>
> The only possible complaints I can think of are:
>
> 1. Redoing the parsing and semantic analysis.
It's pretty darned fast.
> 2. Being uncomfortable about releasing source.
You can turn java bytecodes back into reasonable source code easily enough. And
nothing says you can't run the D code through a comment stripper first.
>
> I'm curious what you have to say about #1. But I consider #2 to be a very
> poor reason because:
>
> - There's always reverse engineering.
> - There's always obfuscation.
> - IL may even provide better reverse-engineering results than machine code,
> depending on the IL.
Yes, it can, as Java disassemblers prove.
> - All the companies sinking time and money into JS and PHP middleware don't
> seem to have a problem with handing out their source.
> - If someone's gonna steal a product and rebrand it as their own, they don't
> usually need the source, and having it would probably only be of fairly
> small help, if any.
> - As a customer, the idea of spending money on a product that I can't
> service myself if/when the company goes under or loses interest makes me
> nervous. Providing their source would given them a competetive advantage.
> - Even though providing source gets in the way of effective DRM (as if there
> even were such a thing), DRM itself gets in the way of sales.
Yup, no DRM on any products I've built.
> - Distributing in source form makes certain things possible that wouldn't
> otherwise be, like virtual template functions (in theory, even if not in
> actual D practice).
Yup again, Java can't do compile time polymorphism!
BTW, I realized around 10 years ago that what you can do is lex D source and use
the token stream as your "intermediate code". It should work great, be compact,
and fast.
More information about the Digitalmars-d
mailing list