Closed expikr closed 6 months ago
IMHO this issue should be moved to https://github.com/ziglang/www.ziglang.org/issues (unless you want some kind of internal support like zig gist upload
? But in this case (I guess) internal support part will be rejected)
this idea would be better imo as a community effort
If https://zigbin.io can have a discovery directory then it essentially solves this need in its entirety.
It would be nice to have a centralized searchable hub for sharing stackoverflow-esq gists, but instead of being a response to needy questioners, it's for people who solved a particular hitch in their realworld usages and wanted to immortalize it as a self-contained gist, easy for future references and allowing others to be helped by it as well as receiving suggestions for improvements or remarks on similar scenarios encountered by others.
Looking through the wiki's community learning resources section, they are all oriented towards more holistic and generalize-able learning materials, such as zig-by-example, so they're not quite well suited to the gists-style samples where they may be domain- or API-specific "aha, that's how you use it in Zig" usages that are nevertheless helpful as a part of a searchable collection.
Another advantage of this solver-submitted rather than questioner-initiated format is that the resulting submission is likely guaranteed to be a real-world solution that the submitters themselves find worthy of being emblemed, as opposed to a bare-minimum solution to get answer points that might have misunderstood the question to begin with.
Being a hub for third-party submission also absolves the first party of the burden to guarantee the quality/correctness of the entries like you'd expect of the ziglang.org examples.
Right now Github Gists is pretty much the only such type of environment, however because it's generic to all languages rather than Zig-focused, it's not very easy to search for domain-specific usages restricted to Zig. It's also not ideal to have a vendor lock-in platform for your knowledge repository, especially for one where it would potentially be massively collaborative.
Selfhosting such a hub provides the advantage of having full control as well as affording more specialization in the submissions exclusive to Zig.
This proposal is motivated by me trying to work out how to hand-write Windows GUI messageloop from scratch, initially to submit to ziglang's examples section. The MessageBox example was simple enough, after it was submitted I then wrote a barebones example for window creation, trying to keep it as minimal as possible but still ended up with the following monstrosity:
As @kristoff-it said, the messagebox example was small enough that it being platform-specific is not a problem. This windowing example is obviously too long, but it still contained enough fundamental sample usages that it's worth being referable somewhere.
Especially for a new programming language, textbooks are constrained by needing to illustrate as many concepts in as few examples as possible, so it cannot afford having many examples illustrating the same concept repeatedly. Having a volume of concrete real-world usages (that aren't quite full-blown repositories that you have to wade through in its entirety) to illustrate the same concept goes a long way in making the learning curve much, much more approachable.