4 ms·
Drat: > To a first approximation, it is an implementation of the AWK language; many common Awk programs produce equivalent output when passed to frawk. So it
by yjftsjthsd-h 5y ago
Drat:
> To a first approximation, it is an implementation of the AWK language; many common Awk programs produce equivalent output when passed to frawk.
So it sounds like it's (intentionally) not a drop in replacement. That's probably reasonable in context but unfortunate in terms of making adoption harder.
- the_duke 5y agoThe Overview page has plenty of details explaining the differences and why they exist: https://github.com/ezrosent/frawk/blob/master/info/overview.md https://github.com/ezrosent/frawk/blob/master/info/overview....
- dotancohen 5y agoThe only real-world difference that I see would be that frawk uses Rust's regex syntax, not awk's regex syntax. I'm actually willing to write that off as an improvement, though it may break scripts. I'd like to see this hidden behind a flag, and the classic awk regex syntax used without the flag. For now, while the classic syntax is unavailable, frawk should error wit ha message that classic syntax is not yet supported. Right now it is too big a footgun. That said, gawk uses PCRE but awk does not. So varying regex implmentations already infect the awk ecosystem. I believe that Debian distros actually install mawk when installing awk via the standard repos. mawk has its own incompatibilities with awk, such as empty string representation.
- asicsp 5y ago>gawk uses PCRE ERE with GNU extensions would be more apt here (PCRE has many more powerful features): https://www.gnu.org/software/gawk/manual/html_node/GNU-Regexp-Operators.html#GNU-Regexp-Operators https://www.gnu.org/software/gawk/manual/html_node/GNU-Regex...
- usr1106 5y agoHow would a statically typed language be a drop-in for something that isn't?
- matharmin 5y agoThis is a different compiler/interpreter for the same language - nothing prevents it from being a drop-in replacement.
- tialaramex 5y agoBut the specific design of Frawk is that it's statically typed. Hence both the title of this thread and the description in the linked documentation. If Frawk sees that you've got a variable N, and you add 1 to it, Frawk concludes that's a number. Seems fair enough and it makes Frawk faster. However for example, Frawk may be quite sure that something is a number, and so when there isn't a value for that - Frawk says the value is a zero. But Awk isn't fixated on the idea that it's always a number, if there's no value awk will say it is the empty string, and why not. Lots of Awk programs don't care, but if yours does it will behave differently under Frawk.
- u320 5y agoI guess the assumption is that working AWK programs will typecheck.