1. 18

  2. 3

    This gave me deja-vu - I thought I had submitted something similar, and sure enough: https://lobste.rs/s/csygqx/no_go_fantasy_writing_go_ruby_with_ruby

    Yes, this is not at-all the same, but my brain made the connection! Ruby to Go, Go in Ruby. What is going on in the world?

    1. 2

      Well, this is wild.

      I appreciate the context in the help subcommand.

      Thanos generates Go from Ruby source. It is intended as an aid to safely porting applications or critical sections thereof rather than a replacement for a Ruby runtime

      1. 2

        Interesting. Have you considered using RBS for more robust type translations?

        1. 1

          I thought about it initially, but it feels very bolted on to me. Other Ruby users I know have had a similar reaction, and for this reason I suspect adoption will remain very low – thus the tool would require an inference mechanism anyway.

        2. 1

          I’m very curious what the use case is here, since the subset of Ruby the project wants to support is unlikely to cover much existing code?

          1. 1

            On three separate occasions I have worked on Ruby projects that have undergone some level of hand optimization – you start by stripping out all the OpenStruct instances, move from ActiveRecord to just returning hashes from the pg gem, etc. When you are done, you are left with something with fairly minimal dependencies. In two of the cases I mentioned above, I rewrote those tools in Go line by line. I would like to have skipped that step.

            I am happy to concede that the work I’m currently planning to do just might not help anyone ever. I do have some wild ideas about how support might be provided for major libraries lean heavily on metaprogramming, but the tool would have to be much farther a long to even consider spiking any of them out.