Linux Applications Programming by Example: The Fundamental APIs (2nd Edition) (github.com)

by teleforce 18 comments 169 points
Read article View on HN

18 comments

[−] discarded1023 56d ago
For those looking for a broader/more portable introduction, Xavier Leroy and Didier Rémy wrote a great high-level text on UNIX system programming a long time ago [1]. Of course it uses ocaml (perhaps motivating some to learn that language) but the style is low-level and straightforwardly imperative. The advantage is that it sweeps up a lot of the messy and boring error handling into the ocaml runtime and/or exceptions. This makes the code a lot easier to follow, but of course makes it look misleadingly simpler than it would be in C (etc).

[1] https://ocaml.github.io/ocamlunix/

[−] up2isomorphism 56d ago
Why would someone want to learn Unix Programming using OCAML? Not a smart choice. Also this does not look easier to read than a shell script either.

let rec copy_rec source dest = let infos = lstat source in match infos.st_kind with | S_REG -> file_copy source dest; set_infos dest infos | S_LNK -> let link = readlink source in symlink link dest | S_DIR -> mkdir dest 0o200; Misc.iter_dir (fun file -> if file <> Filename.current_dir_name && file <> Filename.parent_dir_name then copy_rec (Filename.concat source file) (Filename.concat dest file)) source; set_infos dest infos | _ -> prerr_endline ("Can't cope with special file " ^ source)

[−] hrmtst93837 56d ago
[flagged]
[−] uecker 56d ago
IMHO modern C (with modern tooling) is very reasonable.
[−] jacobgeorge08 56d ago
Thanks! I just started the OCaml Programming Book this week to learn and language and get better at functional programming. Cant wait to jump into this after
[−] NewsaHackO 56d ago
Is there an actual book available?
[−] fuzzybear3965 56d ago
[−] NewsaHackO 56d ago
Of course, I saw that, but if the text of the book is not freely available, then the examples wouldn't really be helpful, no?
[−] Joel_Mckay 56d ago
Linux is rarely a porting issue for C++ or python: https://wxwidgets.org/

Static linking libraries for MacOS or Windows is contaminated by GPL/LGPL code, and this is why wxwidgets excludes the disclosure requirement.

Also, if you are looking for a VueJS cross-platform GUI framework for most Desktop and Mobile platforms (modern MacOS hardware and developer account is a requirement):

https://github.com/quasarframework/quasar

Qt5/Qt6 frameworks sooner or later cause more problems than they solve, and require a lot more maintenance/support.

Best of luck =3

[−] drnick1 56d ago
Why post this without making the text available?
[−] lordmoma 56d ago
what is so fun about this?
[−] andreygrehov 56d ago
What’s the purpose of this submission?