On 22.05.2012 18:45, Roman D. Boiko wrote:
On Tuesday, 22 May 2012 at 14:42:28 UTC, Dmitry Olshansky wrote:
On 22.05.2012 18:04, Roman D. Boiko wrote:
http://d-coding.com/2012/05/22/dct-use-cases.html
>>Find parts of code model by a query (this single point will
be >>expanded into its own series of posts)
Love this idea. Some sort of cool hierarchical pattern syntax would
save megatons of boilerplate. Efficiency may suffer a bit but we have
this CTFE stuff for hardcoded queries ;).
I can easily envision a code transformation of the whole project
represented as a bunch of regex-like expressions.
The complicated part is conceptual, efficiency is feasible to achieve.
Well for starters:
Abuse regex syntax, ban '/' w/o escape & use '/' for scopes/level,
introduce a bunch of better wildcards/character sets like "identifier"
etc. Throw in annotations that work like a list of tags the symbol
should(n't) have: constant, template, function, class, struct, ... see
traits. Same goes for protection & other annotations.
Then it goes like:
demo/{function, pure}f.*/i
->
j
(e.g. simple rename, refactoring looks similarly)
To fetch all of local symbols named i inside of pure functions that
begin with 'f' inside entity demo (entity = struct, class, template,
module depending on where you apply it) and rename them to j.
I suggest to go with such kind of improvised notation with more examples
until you fell that semantics are crystal clear.
--
Dmitry Olshansky