swlkr / janetdocs

A community documentation site for the janet programming language
https://janetdocs.com
MIT License
34 stars 9 forks source link

Initial work on random binding #20

Closed sogaiu closed 4 years ago

sogaiu commented 4 years ago

Here is a sketch of choosing a random binding.

I tried it locally with something like:

https://janetdocs.com/bindings/random

No attempt has been made to fit it in UI-wise. This is just a proof-of-concept.

sogaiu commented 4 years ago

I was thinking that it's not that likely that many bindings would get deleted, given what each binding represents. When do you think bindings might be deleted? May be I've missed something :)

I don't know for a fact but my guess is that count performance may depend on table size, while max does not. Some StackOverflow answers seemed to suggest so, but I didn't test or anything.

Perhaps for janetdocs the table size for bindings is not likely to grow to a problematic size any time soon, but this is just speculation.

As far as deletions are concerned, if there aren't too many, it seems possible that requerying up to N times or just showing some fixed page might work.

What do you think?

pepe commented 4 years ago

True, but you know programmers :-). The feature is dependent too much on the implementation detail (sqlite incrementing its counter monotonically).

Actually, this is better than nothing, especially with the "default" page.

sogaiu commented 4 years ago

It seems to me that the proposed feature is relatively non-essential at this point, so may be just getting something released and possibly updating it later might work? (Famous last words...)

I don't actually mind a different implementation, I just want the functionality :)

swlkr commented 4 years ago

I think it's fine the way it is, bindings would only get deleted if they get removed from janet core in future versions, so hopefully not that often haha

sogaiu commented 4 years ago

Thanks for the feedback.

For the case of a binding being removed in the future from Janet, would it not be useful to retain information about it in janetdocs, but have some indication that it had been removed from the language?

sogaiu commented 4 years ago

So my take is that the current proposal for the underlying mechanism is acceptable as an initial thing to test. Hope I interpreted folks' comments appropriately :)

Assuming so, what might be a good way to integrate this into the janetdocs site from a UI perspective?

One idea is for there to be some link that says something like:

Possibly on the top page somewhere?

swlkr commented 4 years ago

I'm going to merge this and then add a "I'm feeling lucky" to the top of the home page below the search box, like so:

Screen Shot 2020-07-26 at 12 30 56 PM
swlkr commented 4 years ago

I was also thinking about a dice icon in the menu at the top, not too sure about it, kind of out of place:

Screen Shot 2020-07-26 at 12 31 59 PM