D-

Iain Buclaw ibuclaw at ubuntu.com
Sat Feb 11 10:16:23 PST 2012


On 11 February 2012 17:47, Artur Skawina <art.08.09 at gmail.com> wrote:
> On 02/11/12 02:46, Era Scarecrow wrote:
>>>
>>> There is no way you get a D application into 64K. The language is not powerful enough. Only C can achieve that.
>>
>> I'll need to agree. Porting D to a smaller memory space and with cramped features in all of this is not going to be good no matter how you look at it. I'm sure it's similar to comparing using perl in something with only 64k of memory, one must ask where you can put the interpreter, decoding and working with the source text, and many other things, not to mention even if you pulled it off, the speed penalty.
>>
>> With only 64k, you aren't going to need anything extremely complex or elaborate.
>> You MIGHT get away with exporting D code to using C symbols, but you'll likely be stuck working with structs, no library support, no heap, no memory management, and fixed-sized arrays. I doubt you'd need templates, or any of the higher functions. All structures and types must be basic or known statically at compile time. Unlikely for lambdas to be used, and a score of other features.
>>
>> This is all just speculation, but I think you get the picture. If you make a subset of D, it would most likely be named Mini-D. But at that point you've got an enhanced C without going C++.
>>
>
> I assumed the poster you're replying to was not being serious.
> There's absolutely no difference between the code generated from C and D,
> unless you use a few D-only concepts; ignoring compiler issues.
> Having several levels of modules and templates, that in the end emit
> single CPU instructions is not only possible, it lets you write
> completely generic code that's both safer and not less efficient than
> writing the equivalent in assembler.
> I can easily see D being acceptable for 8K projects, 64K would probably
> allow for a mostly complete runtime.
>


I'd imagine the general idea is, just how much of druntime can we
strip away and still have the compiler be happy with all it's implicit
library calls.  After that, then decide what we don't *need*, or could
do in an alternative way and achieve the same result (without loosing
safeness).  I'd imagine there's quite a few things that could be done
differently depending on whether the compiler is building with the
assumption the program is going to be free standing environment, or
will depend on some sort of runtime existing that we'll link to.  What
can't be done may most likely be an error.




-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list