Hacker News new | past | comments | ask | show | jobs | submit login

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 Overview page has plenty of details explaining the differences and why they exist: https://github.com/ezrosent/frawk/blob/master/info/overview....


The 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.


>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-Regex...


How would a statically typed language be a drop-in for something that isn't?


This is a different compiler/interpreter for the same language - nothing prevents it from being a drop-in replacement.


But 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.


I guess the assumption is that working AWK programs will typecheck.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: