make compiler a python function and other small improvements#62
make compiler a python function and other small improvements#62dwRchyngqxs merged 9 commits intomainfrom
Conversation
5c8e90c to
402ecb2
Compare
|
Looks good, I went even further and removed more code duplication/bad patterns, please take a look at the commit above. However, doing so allowed me to also integrate the |
|
Please check my other PR if what you want is to clean the code. It is not the point of this PR, I just integrated some small changes to be match the new |
|
I thought the other PR (#61) is not ready for a review yet. I see the point of the
if verbose:
print(result.to_log())
return
if progress_bar:
progress_bar.update_with_value(result.passed())
returninto if verbose:
print(result.to_log())
elif progress_bar:
progress_bar.update_with_value(result.passed())Besides, shouldn't the type of both Regardless, I think we should pass the compiler=fake_compiler if args.validate_tests \
else lambda test, out, to: student_compiler(build_dir / "c_compiler", test, out, to),we could from functools import partial
...
compiler=(
fake_compiler
if args.validate_tests
else partial(student_compiler, build_dir / "c_compiler")
)Lastly, I think we could have a better name than |
Most of them cover stuff I will change anyway in the other PR and are good here otherwise so they are fine by me. I re applied some of the changes (see coming commit).
No, the function passed should match the type but the compiler themselves conceptually require these arguments, and any compiler we might want to pass as a function will only need those.
As a functional programming aficionado I wanted to do that. But I decided against because was worried of the readability and clarity for standard EEE people. |
|
|
As a non-functional programmer, I still see As for |
|
Looks good, feel free to merge |

This is a prerequisite for the AC PR.