-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 12.06.2014 18:17, schrieb Martin Vidner:
On Thu, Jun 12, 2014 at 04:30:06PM +0200, Lukas Ocilka wrote:
The current Yast code that we will have in SLE 12 is partly automagically translated from YCP to kind of Ruby (also called RYCP), is still using many YCP-like methods for backward compatibility. Partly - because we have already cleaned up some pieces when touching them, following the Boy-Scout Rule [#1] and so the feel quite OK. Of course, we will not be able to cleanup everything we wanted and when SLE 12 is out, we will have to maintain the codebase for years.
I want to prototype a tool to help with converting Rubified YCP to idiomatic Ruby.
I want to try different levels:
- An "aggressive" conversion, which converts *all* Ops and Builtin calls in a file assuming tests are in place to catch bugs,
- A "safe" conversion which leaves functoinality the same even if the dreaded nil sneaks in. Like replacing Builtins.getenv(foo) with ENV[foo]. Or using a simple static analysis to deduce that a variable cannot be nil, like in @help = "" @help = Ops.add(@help, "Part 1 of 42...") @help = Ops.add(@help, "Part 2 of 42...")
Getting rid of the Ops and Builtins calls (what about Convert?) would make the code much more readable. But I see only chance for "safe" conversion (because of missing tests).
David sent me a link to http://whitequark.org/blog/2013/04/26/lets-play-with-ruby-code/ which points to a library that was used to convert between RSpec 2 and RSpec 3 (which is a nontrivial task defeating regex hacks)
[rest of the mail] will reply tomorrow
- -- Gabriele Mohr SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Maxfeldstr. 5 Tel: +49 911 740 53 362 90409 Nürnberg Email: gs@suse.de - ----------------------------------------------------------------- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iD8DBQFTqWTIzwhO63ql6h0RAj1DAJ49yVoiR6+/7WQuieElkA5sTbnS5gCfUokm E6Tpwq4cHn0jRZKIUZqtzaw= =Xg28 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org