4 ms·
Interesting--the author developed his own language with LLVM with which to write the editor: http://tibleiz.net/copper http://tibleiz.net/copper My first reac
by nicklaf 12y ago
Interesting--the author developed his own language with LLVM with which to write the editor:
http://tibleiz.net/copper http://tibleiz.net/copper
My first reaction reading about the program was: since code folding (and other crutches intended to aid refactoring[1]) ought to be tightly coupled to the language (or even specific project) you're editing, you'd surely need the ability to write scripts, lest things begin to get clunky. Emacs immediately comes to mind, but inspecting the code revealed that the scripting language made available to the user is also a creation of the author.
I don't now much about how practical it is to develop
a DSL using LLVM, but I would be fascinated to know how the process compares to Lisp in terms of productivity. Without having read the source code too carefully, one thing I'd be interested to know is whether or not the language written by the author (Copper) and the editor's scripting language are one and the same (as in Lisp). Is there an interpreter somewhere in the editor source? Or are plugins compiled or interpreted by Copper / LLVM at some point?
Of course, the author may also have his own motivations for choosing LLVM--for example, to learn.
All said, fascinating project!
[1] but hopefully not to merely make unwieldy code-bases navigable. (Yikes!)
- swah 12y agoAlso interesting that Copper is self hosted (written in Copper).
- nicklaf 12y agoTo answer my own questions about the intended use for "Code Browser", see: http://tibleiz.net/code-browser/tips.html http://tibleiz.net/code-browser/tips.html Understanding existing source code Code Browser can help you to understand existing source code. There is a lot of tools dedicated to program understanding that will do the job better than Code Browser, but if the source code is written in a too obscure language or too old, it can be a cheap alternative. Here is some tips to make more sense of a flat text file by extracting a structure and reducing its apparent complexity:
- nicklaf 12y agoAnother text editor that treats text as having no grammatical structure (it doesn't even do syntax highlighting), but nevertheless attempts to give the user some really snazzy shortcuts--not keyboard shortcuts, but mouse shortcuts--is Acme[1]. In fact, years ago, I'd contemplated adding text folding to Acme by adding another chord. I don't exactly remember what I had in mind, but one approach that immediately comes to mind now is to have the chord cut the selected text, and then insert in its place a shorter block of predefined text which starts with the name of an rc script to create a file[2] representing a new "fold" containing the cut text, and positioning the cursor immediately after the command. The user would immediately type a name for the fold, and middle click the whole string to execute the script with the name as its argument, thereby creating the fold. Finally, the selected command just executed should be replaced simply with the name of the fold, which should then be selected, so that the user would now be only a right click away from immediately unfolding the text. I think the reason I never got around to doing it was that it seemed that this kind of feature really begs for acme to follow the names of the synthetic files representing the "folds" as files themselves to be opened (via right click, which always opens a file in acme), but at the same time, not literally open the file, instead unfolding it. Writing this comment makes me think now that it wouldn't be so hard to get the semantics of the synthetic "folding" filesystem right, so that Acme remains simply a text editor with a few conventions for working with files, with the "fold" synthetic filesystem doing the work to preserve this simple worldview. What actually concerns me more is the kind of code that would require you to fold it! If need to fold a significant amount of code in order to make sense of your source code, perhaps you would be better if if actually reorganized your project's file structure, and not rely on fancy text editor features as a crutch. [1] http://acme.cat-v.org/ http://acme.cat-v.org/ [2] Of course this feature would use a filesystem to manage the code folds! It's a Plan 9 program, after all.