• lad
    link
    English
    21 month ago

    You’re right, but:

    • Rust goes out of the way to make macro safer and less error-prone, which means it will not be able to cover exactly the same especially in some fringe hacky cases
    • I was commenting along the lines of automatically converting one into another, I find it will either be very difficult or outright impossible without human rewriting the macro from ground up (that is, if we know what problem it solved in the very beginning, otherwise it quickly would become guessing game)
    • @[email protected]
      link
      fedilink
      English
      11 month ago

      There is the project c2rust which is being used to transpile c projects to rust. I didn’t find any mentions on restrictions in this regard but I obviously agree it’s a complicated issue.

      , which means it will not be able to cover exactly the same especially in some fringe hacky cases

      I’m just not sure this is true. Maybe you and I just don’t see that there is always an equivalent solution in rust macros even if it’s going to be unconventional/unidiomatic use of rust macros?

      • lad
        link
        English
        21 month ago

        Maybe you and I just don’t see that there is always an equivalent solution in rust macros even if it’s going to be unconventional/unidiomatic use

        Maybe so, but large part of where it will be impossible is reproducing bugs introduced by unsanitized macros in C /half joking