Re:Myself – v1.0.3
by amelius on Friday April 03, 2015 @04:12PM
(#9318158)
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.
[ Parent
| on HN ]
Re:Myself – v1.0.3
by ineedtosleep on Friday April 03, 2015 @05:28PM
(#9318680)
I'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.
Re:Myself – v1.0.3
by sebastianconcpt on Saturday April 04, 2015 @12:32PM
(#9321261)
No 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.
Re:Myself – v1.0.3
by groundCode on Friday April 03, 2015 @04:35PM
(#9318334)
Maybe literate programming (http://en.wikipedia.org/wiki/Literate_programming) goes some way towards that? Or at least could be extended to do that?
This 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.
Re:Myself – v1.0.3
by dustingetz on Friday April 03, 2015 @04:54PM
(#9318447)
well if you think of "the code" as whatever is checked into git, then we already have that and it works great
Intercal has "COME FROM" so you could use that for appending, but Intercal is designed to be the opposite of feasible and practical...
Re:Myself – v1.0.3
by MetricMike on Friday April 03, 2015 @04:21PM
(#9318231)
How 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?
REM 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
It 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)
Re:Myself – v1.0.3
by nileshtrivedi on Saturday April 04, 2015 @03:09AM
(#9320229)
Ruby seems to support this well as one can always redefine methods and classes.