Name: Anonymous 2011-08-04 1:59
While pondering the abstract qualities of my anus the other day, I have had more great insights. Insights I do so care to share with my beloved /prog/. What I'm about to say may disgust you and delight others.
---
So I'm sure most of you work with langs other than Lisp. More mainstream enterprise stuff like PHP or C++. Gross. It just doesn't compare to the one . . . You know . . that one you understand and love -- that one you would never manipulate or abuse; She is elegant and you treat her with respect (unlike most women.) To show your love, you give her exactly the things she needs out of a unique understanding of her nature. This isn't like playing with C++ or PHP. Those girls are like the hammer that has decided every thumb is a nail -- they are no fun to work with.
Women like C++ and PHP actually want to be manipulated, used, and abused. Sadly for them they have had a really bad childhood. Their fathers weren't the best people in the world . . . they did things to them . . . things that they both enjoyed and despised. Unfortunately, because of this . . . well, let's just say you can never truly have a normal relationship with them.
With that said . . .
These women are disgusting but luckily for us they are also very submissive. We're going to design in concept, a system to change them how you please. It's nothing innovative. It's a custom web-based shell with an editor to run on a development server. This system supports simple flexible macros against text data. The files will be saved and written to disk with their macro's having been applied to the content. In this way you can add macro support to any language without breaking the lang -- The editor becomes a kind of pre-processor, that umm . . . pre-processes the text before writing it to disk. The next time you open the file the editor loads the file without the macros applied (the source file?)
Syntax highlighting for a few of the popular langs is also needed but this code is already written in Javascript (e.g. Ace editor.)
----
For our design let's start with the web. This is a good architecture to choose because the design will ultimately be very cross-platform; It needs to be hackable/workable and a web application meets this description nicely without all the bull shit associated with normal software development.
First, when the user opens a text file the editor MD5 hashes the file's content. This value is now the file's unique ID. The editor then looks in an XML database to see if an entry with that ID exists. (If it doesn't it's created.) The database is an XML file because text files are simple. XML allows for text that is both human and machine readable. This has the advantage of is being able to edit macros from any editor.
The database looks like this:
ID: An MD5 hash of the file's content. The content is the end result of the process. It's a textual file with macros applied if it had any. This id system means that even if a file is moved the macro information isn't lost. Obviously when ever the file is saved we update the id.
Template: Template to create the file contents. This text is evaluated and the result is what is actually saved to a file. This has to be stored otherwise there will be no easy way to to remove applied macros.
The macro database will look like this:
Above I've defined a simple macro that allows me to use "begin" in place of "{" and "end" in place of "}". The manipulations show how text/code can be created using a mixed variety of techniques starting from literal text to full on embedded code that returns code.
Match: The text to modify. It's a regular expression matching the text to replace with the value defined in replacement.
Replacement: A list of manipulations. To get the replacement value you loop through the manipulations starting from the manipulation with a number of 1 and ending at the highest number that exists. Each manipulation returns a value, and this value is appended to the replacement value. This enables you to write code that writes code -- in multiple languages. Also, each manipulation may contain macros, and the macros may contain macros. Hence an infinite number of recursion to get the result may follow before a macro is ever evaluated. Since the manipulation is also text, it is free to include variables that represent the groups of matched text defined in the match regex such as $1, $2, etc . . .
Replacement: An optional description describing what the macro does.
Macros could also be defined in-line -- in the actual code to modify. When saving, the editor will strip them out into a dynamic macro table and then apply the macros to the source text and write the results. The original text is still saved in the same way as the other files.
. . .
For this we just need a shell with the editor. The shell will just be a simple interface that lists the root directory, allows you to edit files, and change directories. For multiple tabs the browser's tabs can be used. Code views are supported by moving browsers around (lol.)
---------
Why none of the editors I use support this is beyond me. Thoughts /prog/?
---
So I'm sure most of you work with langs other than Lisp. More mainstream enterprise stuff like PHP or C++. Gross. It just doesn't compare to the one . . . You know . . that one you understand and love -- that one you would never manipulate or abuse; She is elegant and you treat her with respect (unlike most women.) To show your love, you give her exactly the things she needs out of a unique understanding of her nature. This isn't like playing with C++ or PHP. Those girls are like the hammer that has decided every thumb is a nail -- they are no fun to work with.
Women like C++ and PHP actually want to be manipulated, used, and abused. Sadly for them they have had a really bad childhood. Their fathers weren't the best people in the world . . . they did things to them . . . things that they both enjoyed and despised. Unfortunately, because of this . . . well, let's just say you can never truly have a normal relationship with them.
With that said . . .
These women are disgusting but luckily for us they are also very submissive. We're going to design in concept, a system to change them how you please. It's nothing innovative. It's a custom web-based shell with an editor to run on a development server. This system supports simple flexible macros against text data. The files will be saved and written to disk with their macro's having been applied to the content. In this way you can add macro support to any language without breaking the lang -- The editor becomes a kind of pre-processor, that umm . . . pre-processes the text before writing it to disk. The next time you open the file the editor loads the file without the macros applied (the source file?)
Syntax highlighting for a few of the popular langs is also needed but this code is already written in Javascript (e.g. Ace editor.)
----
For our design let's start with the web. This is a good architecture to choose because the design will ultimately be very cross-platform; It needs to be hackable/workable and a web application meets this description nicely without all the bull shit associated with normal software development.
First, when the user opens a text file the editor MD5 hashes the file's content. This value is now the file's unique ID. The editor then looks in an XML database to see if an entry with that ID exists. (If it doesn't it's created.) The database is an XML file because text files are simple. XML allows for text that is both human and machine readable. This has the advantage of is being able to edit macros from any editor.
The database looks like this:
<xml>
<file>
<id>1rtert4534dfg</td>
<template>
if(1) BEGIN
echo "test";
END
</template>
</file>
</xml>ID: An MD5 hash of the file's content. The content is the end result of the process. It's a textual file with macros applied if it had any. This id system means that even if a file is moved the macro information isn't lost. Obviously when ever the file is saved we update the id.
Template: Template to create the file contents. This text is evaluated and the result is what is actually saved to a file. This has to be stored otherwise there will be no easy way to to remove applied macros.
The macro database will look like this:
<xml>
<macro>
<match>[Bb][Ee][Gg][In][Nn]</name>
<replacement>
<text no="1"></text>
<python no="2">
for i in range(0, 10):
pass
print "{"
</python>
<php no="3">1;</php>
</replacement>
<description>begin to {</description>
</macro>
<macro>
<match>[Ee][Nn][Dd]</name>
<replacement>
<text no="1">}</text>
</replacement>
<description>end to }</description>
</macro>
</xml>Above I've defined a simple macro that allows me to use "begin" in place of "{" and "end" in place of "}". The manipulations show how text/code can be created using a mixed variety of techniques starting from literal text to full on embedded code that returns code.
Match: The text to modify. It's a regular expression matching the text to replace with the value defined in replacement.
Replacement: A list of manipulations. To get the replacement value you loop through the manipulations starting from the manipulation with a number of 1 and ending at the highest number that exists. Each manipulation returns a value, and this value is appended to the replacement value. This enables you to write code that writes code -- in multiple languages. Also, each manipulation may contain macros, and the macros may contain macros. Hence an infinite number of recursion to get the result may follow before a macro is ever evaluated. Since the manipulation is also text, it is free to include variables that represent the groups of matched text defined in the match regex such as $1, $2, etc . . .
Replacement: An optional description describing what the macro does.
Macros could also be defined in-line -- in the actual code to modify. When saving, the editor will strip them out into a dynamic macro table and then apply the macros to the source text and write the results. The original text is still saved in the same way as the other files.
. . .
For this we just need a shell with the editor. The shell will just be a simple interface that lists the root directory, allows you to edit files, and change directories. For multiple tabs the browser's tabs can be used. Code views are supported by moving browsers around (lol.)
---------
Why none of the editors I use support this is beyond me. Thoughts /prog/?