Open ghost opened 5 years ago
@bnmnetp I feel the documentation is lacking in API specifics
@bnmnetp The official website seems to have no more than two demos
@bnmnetp For example, the use of "window.Sk.astFromParse" is not documented at all
Thank you!
@bnmnetp Hi, How to use “inputfun”
Sk.inputfun = options["inputfun"] || Sk.inputfun;
goog.asserts.assert(typeof Sk.inputfun === "function");
I didn't see the corresponding comment
I second that, I would love to now a little bit more about this project, seems so interesting but I don't now where to start (learning it, not just running it)
Maybe this will help: http://skulpt.org/ProgMan
@bnmnetp It appears a lot of pages linked from that website are broken (404). I've been able to view them using a previewer link of the raw HTML files: https://htmlpreview.github.io/?https://raw.githubusercontent.com/skulpt/skulpt/master/doc/static/ProgMan/index.html
But I appear to be struggling to find the very basic documentation too. I've manage get things working through look through other repositories and how they use it, but I would love to quickly see things like:
.configure()
?Sorry, http://www.skulpt.org/static/ProgMan/index.html works better.
I'd like to second/third/nth this request for documentation. I tried to understand what the sample code on skulpt.org was doing, and was immediately frustrated by the lack of either comments or documentation.
In particular, in the sample code, it is not clear:
"<stdin>"
I did eventually find the docstring for importMainWithBody, and then later found the generated documentation page on Skulpt.org (http://skulpt.org/docs/index.html) - which of course is limited to what was documented in docstrings. I also found the not-actually-docstring for Sk.read, which is replaced by builtinRead in the example:
/*
* Replacable function to load modules with (called via import, etc.)
* todo; this should be an async api
*/
Sk.pre is still a complete mystery though.
And both of the provided ProgMan links are currently 404 - whatever ProgMan is.
In particular, in the sample code, it is not clear:
what exactly the builtinRead function/read config option is for?
This requirement has now been removed (since yesterday) and no longer needs to be defined...
the builtinRead
is basically the way to get a module from the std-lib
if not running the latest version of skulpt - you can use the default function in the examples assuming you only want to use modules from skulpt's std-lib. Advanced functionality might override this function.
what Sk.pre is (especially since the code handles putting output on screen separately, in outf)
As far as I'm aware it's useless and doesn't need to be defined. It should probably be removed from the examples - maybe it was previously a thing and just stuck around - but it's not featured anywhere in the codebase (except the examples).
In fact I'd er away from doing things like Sk.pre
so as not to pollute the Sk
namespace unnecessarily...
what the parameters for importMainWithBody are, especially the first parameter, "
"
/**
* @param name {string} File name to use for messages related to this run
* @param dumpJS {boolean} print out the compiled javascript
* @param body {string} Python Code
* @param canSuspend {boolean} Use Suspensions for async execution
*
*/
Sk.importMainWithBody = function (name, dumpJS, body, canSuspend)
"<stdin>"
can be anything you like really I think "<stdin>"
is used because that's typically what you might call it in python when you're reading from the standard input
In skulpt terms - if you do print(__file__)
you'll get "<stdin>.py"
- beyond that the name
property doesn't add anything here.
if you want to support code that can suspend - necessary if you want to use the sleep
function - you'll have to approach the importMainWithBody
with a promise - here's an example I made that might help with some other features - like stopping code in infinite loops.
https://jsfiddle.net/sc549/bjLuq5s7/
I was also very confused at first. I was expecting to see things to get started in the doc, but they are in fact in "Using Skulpt". The docs is not how to use skulpt, but how to improve it.
The Using skulpt is also a little too short in explaination.
The Using Custom Modules section is also strange. It's start by telling you it will explain you how to add custom module, but it then explain you how to add configuration to existing module.
edit : I just discovered why → there is some code that should be displayed that aren't displayed.
<script src="https://gist.github.com/20bd9105f11f2a164fc0.js.js"> </script>
also thanks for the Sk.pre it was the question I was currently asked myself !
Tell us what it is you are trying to do and we can probably point you in the right direction.
If you are trying to embed skulpt in a web page there is an example of how to do that on skulpt.org, and if you are interested in helping out with skulpt development then the HACKING.md document is a good place to start, as is the gh-pages branch.