[Pharo-project] Comment Syntax
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists. Sean -- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
If you only want to avoid evaluating a part of your code temporarily, maybe you'll be better enclosing it within square brackets (making a block that never gets evaluated). Cheers Richo On Mon, Oct 31, 2011 at 5:12 PM, Sean P. DeNigris <sean@clipperadams.com>wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Ricardo Moran wrote:
If you only want to avoid evaluating a part of your code temporarily, maybe you'll be better enclosing it within square brackets (making a block that never gets evaluated).
Thanks for the idea. It may come in handy. In this case, it's not possible because the text I want to put in a comment is an Applescript snippet which contains double quotes, not st code. Sean -- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961576.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Me too. Sean lukas proposed a syntax for that in the mailing-list a year ago. If you find it please resent it. Stef On Oct 31, 2011, at 9:12 PM, Sean P. DeNigris wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
The problem is that both #/* and #/* are valid binary operators, so they don't work well for comments. I don't really remember what I proposed a few years ago, although I remember that exactly the same proposal was made. What would work is to use something like "* and *" (or any other double thing that starts with a double quote). Like this the comments could contain double quotes. As a short term solution you can also put your comments into single quotes. Unused string literals are removed by the compiler. Lukas On 31 October 2011 22:00, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Me too.
Sean lukas proposed a syntax for that in the mailing-list a year ago. If you find it please resent it.
Stef
On Oct 31, 2011, at 9:12 PM, Sean P. DeNigris wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
Lukas Renggli wrote:
What would work is to use something like "* and *" (or any other double thing that starts with a double quote).
I found the issue at http://code.google.com/p/pharo/issues/detail?id=3523 . It has been moved to the "Wish List" [1] (cool that we have one - I didn't know; but not cool that my feature went there to live, lol). [1] http://code.google.com/p/pharo/wiki/IdeasToImplement -- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961725.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
First a confession: I would not mind seeing such a feature. It would be nice if it were portable to other Smalltalks, but it would be useful. That said, (I can't *believe* I'm writing this... <g>) XP advocates would tell us that we don't need the code and to just delete it. With readily obtainable version history, there is a way to recover from such an action. The rebuttal is that versions can get lost overt time, out-of-sight/out-of-mind, etc.. More times than I care to count, clear dated comments, and commented code, have saved me LOTS of trouble. I think the record is that in about an hour, I fixed a defect that had been lurking for several years. Had I removed old code that wasn't quite right, I'd have been in a real spot. But seeing the failure that arose and things that didn't quite work in the past, I was able to create a working solution. Comments are good. Bill ________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] on behalf of Lukas Renggli [renggli@gmail.com] Sent: Monday, October 31, 2011 5:22 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Comment Syntax The problem is that both #/* and #/* are valid binary operators, so they don't work well for comments. I don't really remember what I proposed a few years ago, although I remember that exactly the same proposal was made. What would work is to use something like "* and *" (or any other double thing that starts with a double quote). Like this the comments could contain double quotes. As a short term solution you can also put your comments into single quotes. Unused string literals are removed by the compiler. Lukas On 31 October 2011 22:00, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Me too.
Sean lukas proposed a syntax for that in the mailing-list a year ago. If you find it please resent it.
Stef
On Oct 31, 2011, at 9:12 PM, Sean P. DeNigris wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
Schwab,Wilhelm K wrote:
...It would be nice if it were portable to other Smalltalks, but it would be useful. ... XP advocates would tell us that we don't need the code and to just delete it.
The second point is valid, but only applies to a subset of comments. For example, in my case the thing that needs to be commented is Applescript code that provides context for the method. It is part of the documentation, and must contain double quotes to be valid Applescript. -- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3962192.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
2011/11/1 Sean P. DeNigris <sean@clipperadams.com>:
Schwab,Wilhelm K wrote:
...It would be nice if it were portable to other Smalltalks, but it would be useful. ... XP advocates would tell us that we don't need the code and to just delete it.
The second point is valid, but only applies to a subset of comments. For example, in my case the thing that needs to be commented is Applescript code that provides context for the method. It is part of the documentation, and must contain double quotes to be valid Applescript.
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3962192.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
An alternative would be like in some scripting language : everything after this mark is a comment. We can even doIt easily with Smalltalk-80 parser, I remember that the end of tokens was marked with a DoIt character encoded as value 30 or something like that ;) If you did introduce such character in code, then interpretation did stop at the DoIt mark. I always thought this was a bug - but now I understand a possible usage :) Of course, this only works when Browsing a single method. If you file out sources, then you still have to delimit the method source with doubled bangs ! or something... So take this as a joke more than a proposition. Nicolas
Actually, I think the second point is arguable, for reasons I gave and that you snipped. But they *would* indeed say "just delete it." ________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] on behalf of Sean P. DeNigris [sean@clipperadams.com] Sent: Monday, October 31, 2011 8:57 PM To: pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Comment Syntax Schwab,Wilhelm K wrote:
...It would be nice if it were portable to other Smalltalks, but it would be useful. ... XP advocates would tell us that we don't need the code and to just delete it.
The second point is valid, but only applies to a subset of comments. For example, in my case the thing that needs to be commented is Applescript code that provides context for the method. It is part of the documentation, and must contain double quotes to be valid Applescript. -- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3962192.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On Mon, Oct 31, 2011 at 2:22 PM, Lukas Renggli <renggli@gmail.com> wrote:
The problem is that both #/* and #/* are valid binary operators, so they don't work well for comments.
I don't really remember what I proposed a few years ago, although I remember that exactly the same proposal was made. What would work is to use something like "* and *" (or any other double thing that starts with a double quote). Like this the comments could contain double quotes.
Gilad Bracha chose (* & *) for Newspeak. These are not valid binary selectors and * can't follow ( in valid code. A good choice.
As a short term solution you can also put your comments into single quotes. Unused string literals are removed by the compiler.
Lukas
On 31 October 2011 22:00, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Me too.
Sean lukas proposed a syntax for that in the mailing-list a year ago. If you find it please resent it.
Stef
On Oct 31, 2011, at 9:12 PM, Sean P. DeNigris wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
-- best, Eliot
On 1 November 2011 18:08, Eliot Miranda <eliot.miranda@gmail.com> wrote:
On Mon, Oct 31, 2011 at 2:22 PM, Lukas Renggli <renggli@gmail.com> wrote:
The problem is that both #/* and #/* are valid binary operators, so they don't work well for comments.
I don't really remember what I proposed a few years ago, although I remember that exactly the same proposal was made. What would work is to use something like "* and *" (or any other double thing that starts with a double quote). Like this the comments could contain double quotes.
Gilad Bracha chose (* & *) for Newspeak. Â These are not valid binary selectors and * can't follow ( in valid code. Â A good choice.
Hehe. Pascal has the same syntax for comments.
As a short term solution you can also put your comments into single quotes. Unused string literals are removed by the compiler.
Lukas
On 31 October 2011 22:00, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Me too.
Sean lukas proposed a syntax for that in the mailing-list a year ago. If you find it please resent it.
Stef
On Oct 31, 2011, at 9:12 PM, Sean P. DeNigris wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
-- best, Eliot
-- Best regards, Igor Stasenko.
to me "* *" convey much better that this is a comment. Stef On Nov 1, 2011, at 6:08 PM, Eliot Miranda wrote:
On Mon, Oct 31, 2011 at 2:22 PM, Lukas Renggli <renggli@gmail.com> wrote: The problem is that both #/* and #/* are valid binary operators, so they don't work well for comments.
I don't really remember what I proposed a few years ago, although I remember that exactly the same proposal was made. What would work is to use something like "* and *" (or any other double thing that starts with a double quote). Like this the comments could contain double quotes.
Gilad Bracha chose (* & *) for Newspeak. These are not valid binary selectors and * can't follow ( in valid code. A good choice.
As a short term solution you can also put your comments into single quotes. Unused string literals are removed by the compiler.
Lukas
On 31 October 2011 22:00, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Me too.
Sean lukas proposed a syntax for that in the mailing-list a year ago. If you find it please resent it.
Stef
On Oct 31, 2011, at 9:12 PM, Sean P. DeNigris wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
-- best, Eliot
And while at it, make it right and allow nesting. Please. On 3 November 2011 08:14, Stéphane Ducasse <stephane.ducasse@inria.fr>wrote:
to me "* *" convey much better that this is a comment.
Stef
On Nov 1, 2011, at 6:08 PM, Eliot Miranda wrote:
On Mon, Oct 31, 2011 at 2:22 PM, Lukas Renggli <renggli@gmail.com>
wrote:
The problem is that both #/* and #/* are valid binary operators, so they don't work well for comments.
I don't really remember what I proposed a few years ago, although I remember that exactly the same proposal was made. What would work is to use something like "* and *" (or any other double thing that starts with a double quote). Like this the comments could contain double quotes.
Gilad Bracha chose (* & *) for Newspeak. These are not valid binary selectors and * can't follow ( in valid code. A good choice.
As a short term solution you can also put your comments into single quotes. Unused string literals are removed by the compiler.
Lukas
On 31 October 2011 22:00, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Me too.
Sean lukas proposed a syntax for that in the mailing-list a year ago. If you find it please resent it.
Stef
On Oct 31, 2011, at 9:12 PM, Sean P. DeNigris wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
-- View this message in context: http://forum.world.st/Comment-Syntax-tp3961451p3961451.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
-- best, Eliot
-- Milan Mimica http://sparklet.sf.net
On 10/31/2011 3:12 PM, Sean P. DeNigris wrote:
Would it be difficult/valuable to create an alternate comment syntax? I often find myself wanting to comment a large block itself containing comments. It would be nice to have something like C++'s /* */. I feel like this may have been brought up before, but couldn't find it searching the lists.
Sean
My favorite string and comment handling is Lua. In Lua you can create strings as in many languages with quoting via ' or ". Lua also provides string creation via double square brackets, ie: [[ a string ]] Everything between [[]] is a string. These are there standard conventions. Then they also allow user created delimiters. Any string can be created with [=[ a string ]=] You may place any number of = characters between the two open brackets and an equal number between the two closing brackets. This makes for string creation which automatically allows for inclusion in the string any of the normal string delimiters. The reason I mention this in this thread is that they do similar for comments. Lua comments are single line -- this is a comment Or multiline --[[ this is a multiline comment --]] or --[=[ another multiline comment with user defined delimiters -]=] I don't know if anything like this can be brought into Pharo.* But I think it is an awesome and very convenient way to do strings and comments. *no requirement to use these specific delimiter choices. I never liked the limitations imposed in Smalltalk's string and comment creation. Just a few thoughts. Jimmie
participants (10)
-
Eliot Miranda -
Igor Stasenko -
Jimmie Houchin -
Lukas Renggli -
Milan Mimica -
Nicolas Cellier -
Ricardo Moran -
Schwab,Wilhelm K -
Sean P. DeNigris -
Stéphane Ducasse