Newbie Question 2

Newbie Question 2 - Remove a comment from an instruction - Сообщения

#1 Опубликовано: 30.03.2016 05:05:51
frapuano

frapuano

13 сообщений из 115 понравились пользователям.

Группа: User

Hi,

as usually another simple question.
When I try to develop something it is natural for debugging purposes to place some trace() instructions in between the other lines in a program.
Moreover it is natural that you want to comment some programming lines ( for me mainly the trace() instructions ) and to do this I need to cut the programming line , then insert a double quotes "" and paste in between them the programming line that I would like to comment.
Till now no problem.

The mess happens when i would like to do the reverse. So I have a LONG programming line that I would like to un-comment ...it becomes a nightmare ...there is no possibility to select what is inside the double quotes to cut it and put it back to work .

Best regards

Franco
#2 Опубликовано: 30.03.2016 05:12:55
frapuano

frapuano

13 сообщений из 115 понравились пользователям.

Группа: User

..just a last addition related to something that I have experienced for few minutes and then was not able to replicate anymore.
I was using the Output windows to trace some variables and I was able to write something in it ( I wrote some comments to clarify what was happening ).
But as already stated I was not able to do this twice ..and I do not understand the particular condition that allow me to do this .
What I was asking for is if someone else has experienced something similar ..and if this should be allowed or not or is a non documented feature .

Best regards

Franco
#3 Опубликовано: 30.03.2016 06:13:30
Mike Kaganski

Mike Kaganski

184 сообщений из 434 понравились пользователям.

Группа: User

You may try another way of commenting: since RC4, it's possible to use booleans to avoid evaluation of a part of expression:

Wrote

For Boolean AND and OR operators only required parts are calculated. Unnecessary calculations are skipped now;



So you may use something like
(false) AND (my commented-out debug explression) /pseudocode/
to do what you like, and change "false" (0) to "true" (1) when want to uncomment it.

When you want to "convert" a string to a formula, you need to use a plain-text editor to strip leading and trailing quotes, then copy-paste the result back to SMath.
С уважением, Михаил Каганский
2 пользователям понравился этот пост
ioan92 30.03.2016 06:22:00, frapuano 30.03.2016 06:54:00
#4 Опубликовано: 30.03.2016 07:00:08
frapuano

frapuano

13 сообщений из 115 понравились пользователям.

Группа: User

Thanks a lot Mike for your useful suggestions .

I'll try to get accustomed to this way of operating and to use them in future developments.

In the meantime I hope that always in the future it will be possible to do something to streamline the process of commenting/un-commenting pieces of codes and to make possible to add notes in the Output windows ..looks a stupid request but I think that is something that can be useful ( and that is already possible in same way).

Best regards

Franco
#5 Опубликовано: 30.03.2016 11:29:51
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Franco:

I understand what you are trying to do, but don't understand.
Smath is all equiped to insert "so many" comment lines in the core of a program,
as well as a comment next right to a definition. Visit the next "Fourier Zoom Image".

Jean

#6 Опубликовано: 30.03.2016 15:21:57
frapuano

frapuano

13 сообщений из 115 понравились пользователям.

Группа: User

Joan

see the example below :

Shot1.png

There is loop with line block, I have commented a trace() instructions ( this is valid for any programming instructions, that's for sure ) because in that moment is not needed .
Later on I would like simply to use it back ..and this is not possible except following the Mike suggestion, that is valid and similar to what I usually do but that in my modest opinion is slightly cumbersome and not straightforward as it should be for an operation so normal.

That's all.

Best regards

Franco
#7 Опубликовано: 30.03.2016 18:18:59
Davide Carpi

Davide Carpi

1416 сообщений из 2873 понравились пользователям.

Группа: Moderator

Franco,

I think you don't need comments (although they may come in handy, but this maybe is just matter of improving the math strings)...
You can simply use an if/else statement and a global variable to switch between the "normal mode" and the "trace mode" (even for SMath 0.97, only the selected branch will be evaluated - this means that the other it behaves as if it was commented)

2016-03-30 23_24_24-SMath Studio Desktop - [trace.sm].png
trace.sm

More about trace: https://smath.com/wiki/trace.ashx
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#8 Опубликовано: 30.03.2016 19:17:59
frapuano

frapuano

13 сообщений из 115 понравились пользователям.

Группа: User

Davide

I agree completely with your solution too, that is another way to address my issue.( What I usually do to tell the truth is copy the string in a writer region, remove the quotes and paste it back in the line block)
The rising of this small complain is just because it is a little bit frustrating that you are using a tool that has a visual appeal everywhere and with which you would like to work like you are accustomed to ... so desiring to do a thing that looks very simple ( i.e. deleting left and right quotes from a string )... and instead this is not allowed.

Thanks again and best regards

Franco
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений