4 ms·
This makes me think of a new requirement for a hypothetical programming language: this requirement is that the programming language supports a coding style wher
by amelius 12y ago
This makes me think of a new requirement for a hypothetical programming language: this requirement is that the programming language supports a coding style where additions to the code (new functionality, or bugfixes) are appended at the end of the code text, rather than inserted inside the existing code. I wonder if a language like this would be feasible and practical.
- cben 12y agoREM We'll need a loop. 10 FOR i = 1 TO 64 90 NEXT REM What should we do inside? 50 PRINT "Hello", i, "worlds." REM nah, too many iterations. 10 FOR i = 1 TO 16
- MetricMike 12y agoHow would that be different from the way CSS currently functions, where if B is parsed later than A and references the same selector, B's behavior overwrites?
- groundCode 12y agoMaybe literate programming (http://en.wikipedia.org/wiki/Literate_programming http://en.wikipedia.org/wiki/Literate_programming) goes some way towards that? Or at least could be extended to do that?
- falcolas 12y agoThis is a good example of what the OP is asking for. However, you really have to see an example of it to understand the benefits. The writers of the "Physically Based Rendering: From Theory to Implementation" did this for their book, and it's pretty amazing. They would write text, then a code block: func main() { <main body variable declarations> <main body functions> } followed by another block of text, and then an expansion of the code <main body variable declarations> = var foo int var bar int64 And so on. <main body variable declarations> += var zed rune Which, when run through the "tangler", would produce: func main () { var foo int var bar int64 var zed rune } The first really interesting implementation I've seen of literate programming, and it makes me want to implement it myself.
- dustingetz 12y agowell if you think of "the code" as whatever is checked into git, then we already have that and it works great
- ineedtosleep 12y agoI'd say it's feasible. Practical? Probably not. I'd imagine it would be like a very linear, horribly written story: * John goes to the store and meets a woman named Jane. * Wait, actually her name is Alice and she works at the store. * John tells Alice that he is looking for a widget. * Alice looks for the widget and shows John a list of what she found. * John can't read the list. * John takes a photo of the list and sends it to his friend Jane. * Jane reads the list and texts what she thinks it says back to John. * John promises to get back to Alice once he can read the list. * John gets Jane's SMS. John can't read Jane's SMS. * John throws his hands in the air.
- vacri 12y agoIntercal has "COME FROM" so you could use that for appending, but Intercal is designed to be the opposite of feasible and practical... http://en.wikipedia.org/wiki/INTERCAL http://en.wikipedia.org/wiki/INTERCAL
- iopq 12y agoIt already exists. It's called Git. You append more code in "commits" that modify existing functionality. The previous code is always accessible, though, so it's almost always strictly adding (except for cases where you have to scrub passwords from the history and other edge cases)
- nileshtrivedi 12y agoRuby seems to support this well as one can always redefine methods and classes.
- sebastianconcpt 12y agoNo human creates like this. You are following the illusion of how that code is delivered and not how that code was created. This demo hides from you the countless iterations until it got the result right to later linearly deploy. Your brain knows that creativity is non-linear so you perceive this as an act of genius.