View mode: basic / threaded / horizontal-split · Log in · Help
March 15, 2012
Re: preprocessor pass equivalent?
There's a pull request to help with debugging string mixins:
https://github.com/D-Programming-Language/dmd/pull/426
March 17, 2012
Re: preprocessor pass equivalent?
On Thu, Mar 15, 2012 at 02:51:33PM +0100, Adam D. Ruppe wrote:
> On Thursday, 15 March 2012 at 08:35:48 UTC, Jay Norwood wrote:
> >Is there some option, similar to -E gcc option, that would
> >generate the analogous listing for D?
> 
> You could add one to the compiler in just
> a few lines; there's already a function that
> does it, but it isn't called from anywhere.
[...]

Alright, so I hacked dmd a little to make this a runtime option: I
changed the default symfile extension from .d to .ds so that it won't
overwrite the original source files, and added the option -sym to turn
it on/off. Check it out:

	https://github.com/quickfur/dmd/tree/gensymfile

Playing around with it a little, I notice that it doesn't output
template bodies, even though calls to template functions are left
intact. It also doesn't expand [] into opIndex/opIndexAssign, for
example. So you can't actually compile the output if you're using
templates, AFAICT.

I'm guessing that by this point the compiler has stored all templates in
a symbol table somewhere, so it only has the bare template declarations
left.


T

-- 
The peace of mind---from knowing that viruses which exploit Microsoft system vulnerabilities cannot touch Linux---is priceless. -- Frustrated system administrator.
March 17, 2012
Re: preprocessor pass equivalent?
On Saturday, 17 March 2012 at 00:13:33 UTC, H. S. Teoh wrote:
> Playing around with it a little, I notice that it doesn't output
> template bodies, even though calls to template functions are 
> left intact. It also doesn't expand [] into 
> opIndex/opIndexAssign,

I didn't play with this yet.. but it might not have to do this.

On arrays, [] is a primitive, not a function. opIndex should
only show up on custom types.

For the templates, I'd be surprised if they weren't there
somewhere. My D -> JS code works in the same location
(after running semantic) and templates just work in there.

The instantiations might be in a weird place though.
March 17, 2012
Re: preprocessor pass equivalent?
On Sat, Mar 17, 2012 at 01:21:56AM +0100, Adam D. Ruppe wrote:
> On Saturday, 17 March 2012 at 00:13:33 UTC, H. S. Teoh wrote:
> >Playing around with it a little, I notice that it doesn't output
> >template bodies, even though calls to template functions are left
> >intact. It also doesn't expand [] into opIndex/opIndexAssign,
> 
> I didn't play with this yet.. but it might not have to do this.
> 
> On arrays, [] is a primitive, not a function. opIndex should
> only show up on custom types.

Yes, but I was testing with my custom AA implementation.


> For the templates, I'd be surprised if they weren't there
> somewhere. My D -> JS code works in the same location
> (after running semantic) and templates just work in there.
> 
> The instantiations might be in a weird place though.

Could be. I didn't really do much, just copied the code from your
previous email as-is. I don't know enough about dmd internals to be able
to do much more (though I'll have to get up to speed soon, if my AA
implementation ends up going into druntime).


T

-- 
IBM = I'll Buy Microsoft!
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home