[yast-devel] What about comments for YCP to Ruby conversion?
Hello, in http://lists.opensuse.org/yast-devel/2013-05/msg00027.html Ladislav Slezak wrote: ------------------------------------------------------------------------ the converted YaST code currently does _not_ include comments ------------------------------------------------------------------------ Is my understanding correct that the "currently" therein means that it is planned that the generated Ruby code will include the comments from the original YCP sources? If yes, could you tell an estimated date when this will happen? Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
Hello Johannes, the comments are one of the tasks, which is currently being worked on. So you re right, we intend to translate the comments as well. Obviously, it will happen before we decide to switch git to ruby (and start developing in ruby directly). HTH, Jiri On 06/06/2013 10:17 AM, Johannes Meixner wrote:
Hello,
in http://lists.opensuse.org/yast-devel/2013-05/msg00027.html Ladislav Slezak wrote: ------------------------------------------------------------------------ the converted YaST code currently does _not_ include comments ------------------------------------------------------------------------
Is my understanding correct that the "currently" therein means that it is planned that the generated Ruby code will include the comments from the original YCP sources?
If yes, could you tell an estimated date when this will happen?
Kind Regards Johannes Meixner
-- Regards, Jiri Srain Project Manager --------------------------------------------------------------------- SUSE LINUX, s.r.o. e-mail: jsrain@suse.com Lihovarska 1060/12 tel: +420 284 084 659 190 00 Praha 9 fax: +420 284 084 001 Czech Republic http://www.suse.com -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
Dne 6.6.2013 10:19, Jiri Srain napsal(a):
Hello Johannes,
the comments are one of the tasks, which is currently being worked on. So you re right, we intend to translate the comments as well.
Yes, Josef is working on it, the problem is that the YCP parser does not care about comments and throws them away. The major problem is how to bind the comments properly with the code, you need to know the context around the comment to decide correctly and that's a problem during parsing (you do not know what will be the next node until it's actually parsed...) Of course, comments are essential part of the code so we switch to ruby only after this is solved. This is a blocker for us. -- Ladislav Slezák Appliance department / YaST Developer Lihovarská 1060/12 190 00 Prague 9 / Czech Republic tel: +420 284 028 960 lslezak@suse.com SUSE -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
Hello, On Jun 6 11:16 Ladislav Slezak wrote (excerpt and rearranged):
Dne 6.6.2013 10:19, Jiri Srain napsal(a):
the comments are one of the tasks, which is currently being worked on. So you re right, we intend to translate the comments as well.
... Of course, comments are essential part of the code so we switch to ruby only after this is solved. This is a blocker for us.
Then I also appreciate your switch from YCP to Ruby very much! I look forward to having openSUSE 13.1 (and then also SLE12) without YCP!
Yes, Josef is working on it, the problem is that the YCP parser does not care about comments and throws them away. The major problem is how to bind the comments properly with the code, you need to know the context around the comment to decide correctly and that's a problem during parsing (you do not know what will be the next node until it's actually parsed...)
I am a total layman regarding such issues nevertheless I dare to make a comment: What about changing YCP comments into actual YCP code (e.g. change YCP comments into YCP strings using special string variable names) so that it becomes translated into actual Ruby code (e.g. into Ruby strings) and then change the Ruby strings with those special string variable names back to Ruby comments? I assume this might result a quoting hell when YCP comments contain YCP code (e.g. YCP code that is commented out). Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On Thu, 6 Jun 2013 14:39:58 +0200 (CEST)
Johannes Meixner
Hello,
On Jun 6 11:16 Ladislav Slezak wrote (excerpt and rearranged):
Dne 6.6.2013 10:19, Jiri Srain napsal(a):
the comments are one of the tasks, which is currently being worked on. So you re right, we intend to translate the comments as well.
... Of course, comments are essential part of the code so we switch to ruby only after this is solved. This is a blocker for us.
Then I also appreciate your switch from YCP to Ruby very much!
I look forward to having openSUSE 13.1 (and then also SLE12) without YCP!
Thanks for support. I hope result will satisfy you.
Yes, Josef is working on it, the problem is that the YCP parser does not care about comments and throws them away. The major problem is how to bind the comments properly with the code, you need to know the context around the comment to decide correctly and that's a problem during parsing (you do not know what will be the next node until it's actually parsed...)
I am a total layman regarding such issues nevertheless I dare to make a comment:
What about changing YCP comments into actual YCP code (e.g. change YCP comments into YCP strings using special string variable names) so that it becomes translated into actual Ruby code (e.g. into Ruby strings) and then change the Ruby strings with those special string variable names back to Ruby comments?
Currently we experiment with two different approach. One is based on changed grammar where comments are regular token and the second one is based on enhancing tokens from lexer. Your proposal sound interesting, but there is problem, that you cannot easily change comments into statement like string ___comment = "something"; because comments occur on various places like a && /* comment */ b so replacing such comment into string statement will be quite problematic. We plan to make decision about approach and start with early attempts to translate comments next week.
I assume this might result a quoting hell when YCP comments contain YCP code (e.g. YCP code that is commented out).
Yes, dead code is not nice in comments, but we agreed that we don't investigate semantics of current code and just transform it into ruby comments. Josef
Kind Regards Johannes Meixner
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
Hello, On Jun 6 15:12 Josef Reidinger wrote (excerpt):
I look forward to having openSUSE 13.1 (and then also SLE12) without YCP!
Thanks for support. I hope result will satisfy you.
I already looked at the currently generated Ruby code and I am impressed how well I can understand it (at least on a first glance). I expected much less from automatically generated code. With comments the resulting Ruby code will satisfy me.
Your proposal sound interesting, but there is problem, that you cannot easily change comments into statement like string ___comment = "something";
because comments occur on various places like a && /* comment */ b
No - programmes do not do that - never - really never ever! ;-) Out of curiosity I did a quick search on an older YaST SVN checkout on my local machine for this particular case and got those: -------------------------------------------------------------------------- apparmor/src/clients/apparmor.ycp: Label::BackButton(), /* Label::FinishButton() */ _("&Launch")); reipl/src/Reipl.ycp: //ccw_map["parm"] = ""; /* SLES 11 and z/VM only */ // read only network/src/clients/network.ycp: Label::BackButton(), /* Label::FinishButton() */ _("&Launch")); network/src/lan/hardware.ycp: // NetworkModules::Alias /* FIXME: MOD Lan::Module["module"] */ = card["module"]:""; network/src/lan/hardware.ycp: // NetworkModules::Options /* FIXME: MOD Lan::Module["options"] */ = card["options"]:""; firewall/src/dialogs.ycp: "masquerading", "broadcast_simple", /* "ipsec_support", */ "logging_level", "custom_rules" ]; -------------------------------------------------------------------------- None of those has a real comment that explains any reason why there is that inline comment. Unbelievable! Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On 06/06/2013 04:10 PM, Johannes Meixner wrote:
Hello,
On Jun 6 15:12 Josef Reidinger wrote (excerpt):
I look forward to having openSUSE 13.1 (and then also SLE12) without YCP!
Thanks for support. I hope result will satisfy you.
I already looked at the currently generated Ruby code and I am impressed how well I can understand it (at least on a first glance).
You should keep in mind that the translated ruby code is in ycp style. If a ruby expert writes code it even looks cleaner. Please learn ruby by reading real ruby code.
I expected much less from automatically generated code.
With comments the resulting Ruby code will satisfy me.
Your proposal sound interesting, but there is problem, that you cannot easily change comments into statement like string ___comment = "something";
because comments occur on various places like a && /* comment */ b
No - programmes do not do that - never - really never ever! ;-)
Out of curiosity I did a quick search on an older YaST SVN checkout on my local machine for this particular case and got those: --------------------------------------------------------------------------
apparmor/src/clients/apparmor.ycp: Label::BackButton(), /* Label::FinishButton() */ _("&Launch"));
reipl/src/Reipl.ycp: //ccw_map["parm"] = ""; /* SLES 11 and z/VM only */ // read only
network/src/clients/network.ycp: Label::BackButton(), /* Label::FinishButton() */ _("&Launch"));
network/src/lan/hardware.ycp: // NetworkModules::Alias /* FIXME: MOD Lan::Module["module"] */ = card["module"]:"";
network/src/lan/hardware.ycp: // NetworkModules::Options /* FIXME: MOD Lan::Module["options"] */ = card["options"]:"";
firewall/src/dialogs.ycp: "masquerading", "broadcast_simple", /* "ipsec_support", */ "logging_level", "custom_rules" ];
--------------------------------------------------------------------------
None of those has a real comment that explains any reason why there is that inline comment.
Unbelievable!
Kind Regards Johannes Meixner
-- Thomas Goettlicher SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Maxfeldstraße 5 90409 Nürnberg Germany -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (5)
-
Jiri Srain
-
Johannes Meixner
-
Josef Reidinger
-
Ladislav Slezak
-
Thomas Goettlicher