January 05, 2006
John Reimer wrote:
> John Reimer wrote:
> 
>> James Dunne wrote:
>>
>>> Thanks for taking the time to check it out!
>>>
>>> What do you think of the latest post on {% %} syntax for Identifier generation?  Would really come in handy with templates, yet again.
>>>
>>
>> Ah yes, I see you changed the syntax... if I had only read a little further :).  The colon method was attractive because of its simplicity, but I see that it could cause some parsing difficulties. {% %} certainly stands out, but then it begins to look more like a preprocessor directive; in which case, I guess the C preprocessor was what used to do these sort of things in the first place.  Either way, it would be nice if D or your language could experiment with these options; these things shouldn't require a full blown preprocessor. I fervently hope that we /never/ return to the era of preprocessors.
>>

*Raised eyebrows with inquisitive look on face* =)

> 
> Sorry, James.  After further reading at your blog, I conclude that my above paragraph is completely confused concerning {% %}.  Disregard this paragraph. :P
> 
> -JJR

Hahaha.  No problem.  Though in a way you were somewhat on track, since that {% %} block was intended to succeed the era of preprocessors and let the compiler do the work of generating identifiers.

I guess one general aim of mine is to reduce to a bare minimum the amount of cases where an external code generator is required.  The only obstacle is trying to track down a large subset of patterns I see common in code and trying to alleviate the painstaking work by pushing that work to the compiler instead of leaving it to the programmer (or code generator).

Also, the problem with code generators is (if done naively, and it usually is) that once you generate your code and try to go in and modify it later...then realize your generated code had a bug or you want to refactor it, you're basically screwed.  Unless you know exactly what all you customized in your generated code, you can't go back and regenerate your code and then apply your changes again.  Sure sucks.  Having the compiler do this "code generation" work should prevent this scenario. But I can't say that with 100% certainty of course.

Yeah, I still enjoy the ':' syntax for compile-time properties because it stands out and at the same time doesn't get in the way or look too terribly odd.
1 2
Next ›   Last »