doc icon indicating copy to clipboard operation
doc copied to clipboard

`OUTPUT: «…␤»` for exact vs `OUTPUT eg: «…␤»` for example/random outputs

Open mykhal opened this issue 4 years ago • 5 comments

In most cases of doc code examples, the OUTPUT: «…␤» is deterministic and is sort of a test case.

In some cases (e.g. when containg rand, .pick, .roll, .WHERE, now, …) the output is non-deterministic. It might not be always obvious for everybody.

It would be helpful to denote these in a different way, e.g. OUTPUT ex.:
(I can't see a Unicode symbol for example.)

mykhal avatar Jul 29 '21 16:07 mykhal

Pretty good idea. Thanks!

JJ avatar Jul 29 '21 17:07 JJ

@raiph English tongue is not my native one, I guess that "eg" is better example abbr. than "ex"; and thanks for making the title more clear.

mykhal avatar Jul 30 '21 18:07 mykhal

Well, if we're going to get all academic, e.g. (exempli gratia) would the the better substitute for ex (example) which looks good to me anyway...

JJ avatar Jul 31 '21 07:07 JJ

Sorry if my (late) response seems a bit off-topic, but this actually touches on two peeves that I have about the docs:

(1) I really dislike this business: << .. NL>> . It's precise to a degree that's usually not necessary and ends up being distracting visual noise more often than not (just needing to realize that that NL char is a visible representation of a newline is a small but unnecessary barrier to overcome-- and it's particularly odd because we already have a newline representation that you need to know to write code: "\n"). It's almost always good enough to say

# OUTPUT:  expected string

(2) The code examples with random output (e.g. using "pick") don't usually need to do that, and could be re-written with deterministic output. This is part of a bigger problem though, if you're writing for rosettacode using every feature you can is a good idea, if you're writing for the raku docs, you want to focus on just the feature you're trying to demo, and you don't usually want to send someone sideways to understand what something like "pick" does.

doomvox avatar Oct 05 '21 20:10 doomvox

Well it's got its origin in the responses by the Camelia bot in IRC. The original authors (and myself) used it to cut and paste responses. Anyway, the OP seems quite reasonable: just clarify that YMMV. And you're correct, featuring the right feature will force us to be minimalistic in the code, and thus to show that the output might vary. At the end of the day, since we are in Hacktoberfest, I'd happily accept a PR that would hightlight variable output with e.g. or some other way of making that clear.

JJ avatar Oct 06 '21 10:10 JJ

I'm leaning towards both "we don't need to be this specific and note variable output" and "we don't need to be this specific and show the newline character"

coke avatar Mar 04 '23 21:03 coke