flat assembler
Message board for the users of flat assembler.

Index > Main > Add block-comments into Fasm?

Goto page 1, 2, 3  Next

Add block-comments into Fasm?
Yes, absolutely
56%
 56%  [ 37 ]
I use this sparely (in other languages)
12%
 12%  [ 8 ]
No need
19%
 19%  [ 13 ]
Don't do this, it would anticipate with Fasm's concepts
9%
 9%  [ 6 ]
Donno
3%
 3%  [ 2 ]
Total Votes : 66

Author
Thread Post new topic Reply to topic
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
I recently managed to add a "toggle comment" (look at "IDE Development > Added some cool features in FasmW IDE") feature in the FasmW IDE, but I think it would be more wise to implement a block-comment syntax element into Fasm.

This would especially be useful if testing new code, for example entire new procedures, but when you want to keep the old one. Toggling each line with ";" is sisifus, Ctrl+T works fine for this, but a block comment feature would be more nice because this would be more easy to add if editing assembler sources with other editors. (You cannot tell every editor maintainer to implement a toggle assembler comment feature).

So, I started this poll. Give me (rather to Privalov) your opinion, since I have no specific idea of implementing such thing in Fasm directly and myself.

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 07 Dec 2004, 17:24
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
Write me also what this block comment should look like.

something like
Code:
comment
...
end comment
    


or rather C-style
Code:
/*
...
*/
    


PASCAL-style would cause problems with macros.

What about his one
Code:
;_
...
_;
    
Post 07 Dec 2004, 17:27
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
good idea, i was missing comment blocks a bit too

an alternative for {} from pascal is from c :

comment {i 'm a comment block}
Post 07 Dec 2004, 17:40
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Block comments would be nice... and would there be any reason to *not* use the C style block comments, apart from "blah blah it's highlevel"? Wink
Post 07 Dec 2004, 18:14
View user's profile Send private message Visit poster's website Reply with quote
Frank



Joined: 17 Jun 2003
Posts: 100
Frank
A simple pseudo-macro can do the trick. Why bloat the assembler unnecessarily?

Code:
macro comment {

proc MyPreviousVersionOfTheProc
  enter
  return
endp

}
    
Post 07 Dec 2004, 18:33
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2145
Location: Estonia
Madis731
Aren't the block comments dangerous, error-prone?
It's just what my teachers say - I don't believe it. Very Happy
Post 07 Dec 2004, 19:40
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
I have heard this, too. But I had never had any problems with block comments in PASCAL/Delphi/C/C++ yet. Especially when you don't use nested comment blocks.

Like
Code:
{
some kind of your code

{something else
}
}
    
Post 07 Dec 2004, 20:00
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
well if i think over { means begin, } means end, but what if you enter this without any macros?
{
comment?
}

this special case could be considered as comment too, as for the macros, well, its not that good in macros, you'd be forced to use for example comment{ i 'm a comment block } or /* i'm a comment block */

there is no problem using begin comment in comment, but if you begin {
then it should be counted like
{nested commenting level 1{nested commenting level 2{nested commenting level 3}eof nested commenting level 3}eof nested commenting level 2}eof nested commenting level 1
Code:
<begin {=1>nested commenting level 1<begin {=2>nested commenting level 2<begin {=3>nested commenting level 3<end }=3>eof nested commenting level 3<end }=2>eof nested commenting level 2<end }=1>eof nested commenting level 1
    


it could be implemented, though i see no advantage of using nested comments Smile

it whould brobably be an unused advanced feature
Post 07 Dec 2004, 20:12
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
I fully agree with you, Matrix in terms of nested comments.

Another thing, Mamatrix. I discovered a bug in the FasmW IDE editor.
Look for "IDE Development > Bug in FasmW's paste" to get the details.
Post 07 Dec 2004, 20:21
View user's profile Send private message Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea
I am in the side that comments are not part of the source of a programm, then instead of use comments, delete the suport for them Very Happy. (OK, that is only my case... I guess)
Post 07 Dec 2004, 20:24
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
So, you would move every part of your code to another, say temporary, file just because you wanna try/test something new? Man, this would be to complicated for me!!! Wink
Post 07 Dec 2004, 20:33
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld
Maybe
Code:
; few
; commented
; lines    
would be enough?
Or maybe
Code:
;{
 some
 comments
 here
;}    
is somehow better?
Post 07 Dec 2004, 21:29
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
i'm having an idea,
fasm could be more than any other again with not just a simple
Code:
mov ax,3     /*
 comment block
mov ax,2
 */
but in addition it could do : comment rectangle block :

where first byte of /*/ defines top left beginning of comment block
and first byte of */* defines lower rght corner of comment block

/*/-------      label:             
mov ax,3      mov ax,2
mov al,4       mov al,5
stosb            mov [es:di],al
---------- */* ret    
 
in this case, the first column whould be comment, and the one near whould be actual code

so this whould be the comment

-------
mov ax,3
mov al,4
stosb
---------- 

and this whould compile:

label:
mov ax,2
mov al,5
mov [es:di],al
ret
    


what do you think of this?
Post 07 Dec 2004, 21:45
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
block comments having "stream" structure (not "line" structure) interfere with the one of the main principles of assembly languages - "line-based" structure of the source.
Of course it is not so much work to make such comments for FASM (for example FASM's macroses and some preprocessor directives have "stream" structure as well) , but there will be some problems with readability of the code.
Also, as far as, the assembly language editors (I am talking about FASMW and Fresh) are line based. So, it will be hard to provide syntax highlighing for block comments without big rebuild of AsmEdit control.
Without syntax highlighting, big block comments (more than one screen) can impact the readability of the source, because there is no way to determine that this is a commented block other than syntax highlighting.

On the other hand, Fresh have functions for block comment/uncoment of group of lines. IMHO, such function can be very decent replacement for block comments, without changing of FASM syntax and without negative effects.

Regards.
Post 07 Dec 2004, 22:55
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
i saw fasmw using vertical selection, and comments could be highlighted in the same way, so readability could stay, and this could reduce the time needed to replace a little code snipplet and comment it out at the same time.

why are you sticked to that line based thing? we live in a 3d world
and we see stripes on the monitor below each other displaying close to each other.
Post 08 Dec 2004, 00:25
View user's profile Send private message Visit poster's website Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea
MCD wrote:
So, you would move every part of your code to another, say temporary, file just because you wanna try/test something new? Man, this would be to complicated for me!!! Wink


I am in the side that such things are not part of the assembler Smile, even the language, such comments, for programers, for understand the code should be handled by the editor, also a editor that can switch easely to add a comment, for example, I hve watched sources in C that use some like /* FIXME */ /* TODO: */ and a lot of other things, even comments like: // This function is called when...., now let see the called automatic documentaion, aca Doxygem and others ones, they exige you tah you learn a new sintaxis, even that you can have a editor for do the work, and the more impactant at less for me is that they need to be inserted in your code!!!!




I will not explain all that I have in mind, but sure if some time you see a compiler, assembler or some like that developed by me, it will not allow comments in the source code of X language Razz.


Butlike I say, that is only my case Wink.


Now following your pool, I consider that is more easy selection and do a automatic block of comments Wink.

Extra... by the way, I will have a new signature "A language should be understable, not commentable Razz and a derivation of the language should continue being understable"

_________________
A language should be understable, not commentable Razz and a derivation of the language should continue being understable
Post 08 Dec 2004, 01:10
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
FASMW and Fresh are open source.
Post 08 Dec 2004, 03:01
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2145
Location: Estonia
Madis731
JohnFound wrote:
FASMW and Fresh are open source.

It has nothing to do with the topic we are discussing. Of course anyone can make their macros compile BASIC or C code with FASM, but are the block comments needed in the main distro? THAT is the REAL question.

My opinion is that an option to comment more than one line with an ";" is better that block comments. The main reasons are:
1)readability - think of comments over pages long. Highlighter would have to search forward and backward in the document.
2)the syntax didn't seem to be agreed on amongst some posters here. The offered variants were all odd - didn't seem right.
3)and it IS error-prone - I was thinking of removing blockcomments. When you remove one end, you must immediately remove the other end too, because otherwise you'd have the rest of the source commented.

_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 08 Dec 2004, 09:46
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 885
Location: \\world\asia\malaysia
vbVeryBeginner
i have been thinking on this comment feature sometime ago.
i guess it is quite hard to decide a new comment syntax or ...whatsover coz asm has been traditionally in single line comment mode. well, i do love multiline comment feature.

my suggestion is, since fasm in so much influence using the dot
i guess it should be nice to use dot to represent comment. and possibly change the trandition of using the ";" and create own fasm style, and reshape the asm history :p

Code:
.. single line comment

.. dot dot start, whatsover
here is comment
until it met another 'dot dot' which must at the end of line ..

.. comment line 1
line 2
line 3 .. 
line 4
line 5
line 6 ..

in the above example, line 1 till line 6 would be commented Smile
i guess i like this :p, remove line 6 dot dot and only line 1 till line 3 are commented Smile

    

when encounter first dot dot, comment mark start until it reach another dot dot which must at the end of line before [line / carriage return], and comment marks end.

.. automatically mark single line comment, but if dot dot before [ret] found, line starting from .. to current would be commented.

Code:
we didn't start our comment using the dot dot
whatsover comment
and we use dot dot at the end .. <----------------------- line 56

the above line should generate error at line 56
    


sincerely,
sulaiman chang :p
Post 08 Dec 2004, 14:56
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Madis,
#1 - comments that long should be moved to external documentation
#2 - C-style block comments are fine Wink
#3 - is that really a problem? And removing the begin-comment was never a problem with C-style comments, at least if you use the /* /**/ trick...

I think supporting block comments is a good idea, I've always missed them in assemblers that don't support them. It should be trivial to code, and in no way "Bloat" FASM - there's a difference between adding a nice feature and adding bloat. How much would the support be, a couple hundred bytes of code at most if sloppily coded? And would it affect speed? Doubtfully.

As for people saying code shouldn't be commented, that's your choice - no reason to remove commenting support just because *you* don't like it Smile.

Rectangle comment blocks are an interesting idea, and I've had the thought myself... but I'm afraid it would be way too confusing to be actually useful. Perhaps if it was tightly coupled with a syntax-coloring IDE, but I don't think it's a good idea tying a language so closely to it's IDE that you can't use it without.
Post 08 Dec 2004, 15:01
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.