Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code validity check #27

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Dec 2, 2021

I'm opening this for discussion. What do you think about validator that would check that code inside Python blocks is valid (can be compiled, does not raise any Exceptions when executed)? It could try to compile/execute the code and warn the user during compilation if the code is invalid.

If the code should be invalid (e.g. uses undefined variables, raises exceptions), then it could be marked somehow in Markdown (e.g. ```python,can-fail). Previous code blocks could also be automatically appended to the block that is being compiled to provide context for variable names.

The motivation is to avoid errors like this.

This is obviously quite dangerous, so it would have to be executed inside Arca or something like that.

@encukou
Copy link
Member

encukou commented Dec 7, 2021

It can be made opt-in, either course-wide or for individual lessons.
It would be nice to try this with existing materials and see how much they need to be changed. I don't have too much hope – I'm not using "literate programming". Not all code that the student needs to write is shown in code blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants