Arc Forumnew | comments | leaders | submitlogin
2 points by shader 1532 days ago | link | parent

I don't think including the tests alongside the code would help much; many tests are rather complicated, involving set up, take down, and more complex assertions than just 'eq. Not that one couldn't understand what it meant, just that it's not as clear as an example.

I hadn't thought of the use case for wanting examples while perusing the code itself, but I must admit that I find that somewhat uncommon. I don't often know which file a function is defined in, and rarely need it given the help support we have in the repl. If I do want to look at the code, the 'src utility shows the source of a function. If I want to edit it, I often use the help utilities to find the file anyway. So having the results only available via the repl wouldn't bother me any.

C and D can get by with just evaluating the examples and showing the output.

1 point by akkartik 1532 days ago | link

Ok, so you'd be satisfied if we just included the examples in docstrings?


2 points by shader 1531 days ago | link

No, unless you wanted to dynamically read the examples from the docstrings to evaluate them when the examples are queried, either directly or as part of help.

Actually, I don't know if the examples should be automatically displayed with 'help, or queried separately.

Either way, it would be nice to make them automatically evaluated, unless they can't be for whatever reason. It seems like that would be easiest to do with something like the existing examples macro, but if you think it would be doable with docstrings I guess that could work.


1 point by akkartik 1531 days ago | link

Ah, ok. So you don't care about being able to see them next to the function, but you would like some way to see them at the repl along with their results. Let me know if I'm still missing something.

(Sorry I'm asking basic questions. The discussion has ranged far enough that I just want to circle back to nail down precisely what you're suggesting among all the use cases and possible UIs.)


2 points by shader 1530 days ago | link

Well, that's what I'm suggesting. I don't see the other cases as essential, and the interface seems simpler that way. I'm lazy too, which means that if I'm making examples, I'd rather not have to provide the results. Not that I couldn't, but I'd like the option at least to do otherwise.

As always, you don't have to change anything just to meet my opinions. I'm used to being in the minority, in fact.


1 point by akkartik 1530 days ago | link

Thanks! Just want to record your feedback for the record. We'll see if I do anything about it.


1 point by akkartik 1529 days ago | link

(It's not yet clear what the majority opinion is here.)


2 points by shader 1529 days ago | link

Maybe nobody else cares. It's a pretty small community at this point anyway, and I doubt everyone checks daily. I know I've gone through long periods without checking.