3 ms·
What about the standard library?
by macleginn 6y ago
What about the standard library?
- qznc 6y agoNot as comprehensive as Python. However, you can write scripts which pull in packages from the internet called "single-file packages": https://dub.pm/advanced_usage https://dub.pm/advanced_usage Just tried it myself for the first time: #!/usr/bin/env dub /+ dub.sdl: name "hello" dependency "requests" version="1.1.5" +/ import std.stdio : writeln; import requests : postContent; void main() { auto content = postContent("http://httpbin.org/post", ["name": "any name", "age": "42"]); writeln(content); } On Linux, put this into a file, chmod +x it, and execute. The first time it will take a while (downloading and compiling packages). After that on my crappy laptop it takes: 0.66user 0.06system 0:01.25elapsed 57%CPU That is a lot more convenient than venv in Python.