by gavinhoward · 2y ago · 0 comments
POSIX utilities are not great. Lex and Yacc included.
I say this only as it has been many years since I have written one, but I thought this OCaml presentation on a POSIX shell held the structure in high regard.
https://archive.fosdem.org/2018/schedule/event/code_parsing_...
I am partial to hand-coded recursive descent purely because I struggled with Lex and Yacc too much when I tried.
And a lot of magic, with special variables, macros, and functions that you must know. And unclear scoping.
[1]: https://gavinhoward.com/2023/02/why-i-use-c-when-i-believe-i...
My take on POSIX utilities would be only to use them on Linux platforms where they effectively form a "native" part of the platform.
https://en.m.wikipedia.org/wiki/Microsoft_POSIX_subsystem
Microsoft had previously been the largest AT&T UNIX licensee with Xenix sales on the TRS-80 model 2, so they were familiar with the need.
Yes, you should only use them on POSIX.
My utility does build natively on Windows, though.
Does Windows claim POSIX compatibility these days? I didn't think so? I remember NT's old POSIX subsystem, but is that even a thing anymore?
> My take on POSIX utilities would be only to use them on Linux platforms
I mean, only use them on POSIX-compliant systems. Linux is just one of them.
At the risk of sounding childishly derisive, when someone is talking about "portability", I think they're generally not bothering to include Windows in the mix, as Windows doesn't really share all that much of a common denominator with much else.