As far as raw mode-specific text generation is concerned, msf-abbrev
is probably fine. It has the advantage of being able to mix elisp
code into the template. SRecode keeps the elisp separate. You write
lisp code to implement special arguments for the templates which will
fill in predetermined macros in the replacement dictionary. This
makes srecode more suitable for development of code-writing programs,
and repetitive macros since the lisp logic is shared among all
modes.
As for refactoring, only time will tell. Since that is a programming
task, I would guess srecode would be ok at it.
Srecode is just a framework at the moment and needs to have some apps
built on it to prove it's worth.
Eric
>>> joakim@... seems to think that:
>"Eric M. Ludlam" <eric@...> writes:
>
>Ok, its clearer now. msf-abbrev is similar to srecode in that each
>template is a file, that offers some simple logic appart from simple
>insertion, and also a way to fill in forms.
>
>the abbrevs are also mode specific, so abbrevs with the same name
>expand to the same thing in different languages.
>
>That is, "mainx" expands to a main function in C, and a main method in
>Java. This is very convenient. I also use it in conjunction with
>"planner" to document stuff that is easy to forget, like what does a
>for loop look like in bash, python, java, ocaml, etc? The planner page
>includes the msf files, and provides some explanatory context.
>(msf can also interface to semantic, but i havent used that much)
>
>OTOH, some things that would be nice to be able to do, arent, which I
>suppose srecode would be better at. like, i dont want to remember the
>particular api to use to figure out the Nth element of a sequence, in
>different languages, and for different types in the language. semantic
>would know the language, and the type, and offer the correct expansion
>of nthx(thesequence) depending on context. I find myself having to
>look up basic stuff like that way too often. msf could maybe do it
>also, since it interfaces with semantic, but srecode might win
>usability points there. guess ill have to try it to know :)
>
>srecode can assist with refactoring as well i suppose?
>
>>>>> joakim@... seems to think that:
>>>"Eric M. Ludlam" <eric@...> writes:
>>>
>>>> I've checked in some changes over the weekend that some of you should
>>>> enjoy.
>>>
>>>Nice! I havent actually looked at it yet, but how does srecode compare
>>>to my current favorite template system, msf-abbrev?
>> [ ... ]
>>
>> I hadn't looked into msf-abbrev in that the short EmacsWiki
>> description made it sound like abbrev.
>>
>>>From the detailed wiki page, it looks like msf-abbrev seems to use
>> in-buffer widgets to make some selections which srecode doesn't
>> currently do, though that was already on my todo list for some
>> far-distant future.
>>
>> On the other hand, srecode will do looping and if statements via macro
>> syntax, and has a wide range of pre-defined macro values you can hook
>> into.
>>
>> I wrote my own template system because the ones I looked at didn't
>> support what I needed. msf-abbrev may have supported what I want to
>> do. I'm not sure. In the end, inserting a template is not that hard.
>> Just use 'insert'. Defining a nice way to write them is only slightly
>> harder.
>>
>> What I actually care about isn't really a template language, and a
>> simple way to insert them. That's just a baseline. Having lots of
>> templates with predictable names matching various context locations so
>> that it is possible to have lots and lots of templates which behave
>> the same for multiple languages, and have the templates you want easy
>> to find is what I'm after.
>>
>> I also want it to be easy to write applications that can take
>> advantage of pre-named templates so that all the various code-writing
>> apps will eventually write the same style code so users only override
>> one spot, and all code writing apps will use that change.
>>
>>
>> You could look at it like this. I'd like it to be easy for COGRE to
>> auto-generate code form UML diagrams. Thus, if someone writes a set
>> of simple templates for outputting classes, methods etc, then those
>> templates can be used in both the msf-abbrev way, and in a fully
>> automated form out of COGRE. If a user doesn't like the default
>> comments for some language, they override one template or macro value,
>> and all his templates change to use that single comment inserter, plus
>> COGRE now writes that same comment style.
>>
>> srecode is probably not a good thing to transition to from msf-abbrev
>> at this time. If you want to write an app that writes code, however,
>> then srecode is the platform to start with.
>>
>> I'm still working on the cross-referencing design, naming scheme, and
>> some simple examples. There's enough around, however, for some
>> complex template writing experiments. I'd love to hear how it works.
>> I find myself already dependent on srecode for filling empty files for
>> me.
>>
>> Enjoy
>> Eric
>>
>> --
>> Eric Ludlam: zappo@..., eric@...
>> Home: http://www.ludlam.net Siege: http://www.siege-engine.com
>> Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org
>
|