Moonshot: a DMD fork that outputs Lua

Mithun Hunsur via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Feb 21 14:35:50 PST 2017


On Tuesday, 21 February 2017 at 16:18:44 UTC, Stefan Koch wrote:
> On Tuesday, 21 February 2017 at 12:45:47 UTC, Mithun Hunsur 
> wrote:
>> Hi all,
>>
>> Introducing Moonshot (https://github.com/Philpax/moonshot)!
>
> Hi Mithun,
>
> Looking over the code for lua it seems that you use std.format 
> a lot a ctfe.
> I would advise against that as it needlessly increases compile 
> times.
> The built-in concat operator is supposed to be faster in many 
> cases.
>
> I am interested in how you handle complex types i.e. structs 
> with pointers of the same struct type and the like.
>
> I think moonshot is a worthwhile effort.
> Congrats for getting something like this to work.

Hi Stefan,

I figured you'd have some thoughts on the matter! You're right, 
I've used `std.format` a fair bit out of convenience; I'll see 
what I can do about going back to regular old concat.

I'm not sure about how I'm going to support pointers/references 
yet, but I suspect the case you've suggested should be fairly 
simple. As Lua has reference semantics by default, I'm 
representing the struct as a table that gets copied on 
assignment; this means the representation of Struct* should be 
the same thing, but without the auto-copy.

(Ooh, there's a fun subtopic for a potential talk: representing 
value types with reference types.)

Thanks for the feedback!


More information about the Digitalmars-d-announce mailing list