Closed danse closed 11 years ago
duplicate of #2355 about .load What's your proposal ? Inline doc-and-test ? This was rejected by @jashkenas already (I can't find it) but why would you write tests in the REPL rather than in test files ?? IIRC, REPL needs to be rewritten anyway. See #2626.
I'm afraid I don't see what change you're suggesting here. Feel free to clarify, and we can talk about it.
@Nami-Doc, @jashkenas : I'm very sorry I wasn't able to explain myself.
I'm simply suggesting to replace coffee>
with something shorter (like >
) as the default interpreter prompt line.
This could be relevant if doctests for coffeescript will ever exists (currently I'm following an interesting project which implements them), since it is quite common to paste interactive experiments on a source file, when using doctests.
Probably my digression about the advantages of doctests was just confusing. I found doctests quite powerful, but I'm afraid that a long prompt could discourage people from using them, on the long run.
This is why I'm suggesting to plan a change in the prompt, as long as there are not compatibility issues.
Ah. What about a simple replace ? Replacing coffee>
with // >
should be okay, no?
Of course there could be many ways, for example a simple replace, as you said, but if there are not other constraints on the prompt appearance, why to not go towards the simplest way to show a prompt?
By the way, the replace should be the opposite. A correct doctest implementation with the current prompt should present # coffee>
on the command lines, and this is not a problem on paste. This could be uncomfortable when writing by hand, and it is unlikely that someone would just write # >
and then substitute them with # coffee>
.
The whole matter could look silly to you, but I personally think that the power of a language comes adjusting its most common features in the most essential way, when there are no reasons to do differently.
Seems a bit strange considering coffee uses #
for monoline comment.
thanks, fixed
Hello, I ask you (coffeescript community and maintainers) to consider a change in the
coffee>
prompt, in order to be more essential, along with the general coffeescript design.This may look negligible for you, but just consider the development of proper coffeescript doctests, as those python has. Such development would lead either:
Doctests help improving code quality easily! An use case: imagine reading some really weird code:
You wonder: "what's the purpose"? So you fire your console:
Uhm ... I see what is the idea ... but it can be highly improved! So, first of all, let's paste the interactive example into the file:
Now I have regression tests for free ... just after playing with the function from the prompt. I can refactor the function, and have a precious way to spot problems with regression, quickly and easily!
The code I wrote was not weird enough, but just think how many funny expressions people can build using javascript regexps ...
I hope you will consider my request seriously.