So, this uses a macro, but if you’re thinking anything is possible with a macro, it’s actually not in Rust. The input does still need to parse as valid Rust tokens.

Which means the authors asked themselves at some point: Is the Rust syntax a superset of the Python syntax?
And well, it’s not. In particular, some Python keywords will just be tokenized as an identifier (like a variable name).

But it is close enough that the authors decided against requiring a massive string to be passed in, which does amuse me. 🙃

  • cabhan@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    With projects like these, I’m always torn between thinking that it’s cool it’s possible, and horror that someone somewhere will try to use this in production code.

  • flashgnash@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    This is absurd, the amount of effort that must have gone into this purely for shits and/or giggles

    • fossphi@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 month ago

      shits and/or giggles

      That’s probably the single most impactful cause for doing things with computers