Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Experiment - Multiple uses for the apostrophe

 
Post new topic   Reply to topic    Bay Six Software Forum Index -> ViviFire language
View previous topic :: View next topic  
Author Message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Mar 10th, 2012, 7:10pm    Post subject: Experiment - Multiple uses for the apostrophe Reply with quote

This is yet another thought experiment to gauge potential users' reactions to VF's syntax.

The apostrophe (') will likely be overloaded for numerous purposes. Mostly it will be used to comment code.
Code:
' This is a comment.

pi = 3.14 ' This is another comment.

Additionally, VF will introduce block comments.
Code:
'<
This is a simple block comment.
It can span multiple lines.
>'

This would also allow comments within lines of code.
Code:
x = foo(bar, '<default>', baz)

Like C/C++, block comments may not be nestable. To make nestable comments would require explicit labeling.
Code:
'<foo>
This is the first level of comments.
'<bar>
This is the second level.
You can continue nesting as long as each block has a unique label.
'</bar>
Now we're back in the first level.
'</foo>

Now for something completely different.

I think it's a bit ugly how most BASICs require a function call to get the ASCII or Unicode number of a character. In LB you use ASC("A") to get 65. C/C++ allows one to write 'A' and it gets treated like 65 on most modern computers. VF should allow you to write ('A') and get the same result.
Code:
' Go through the alphabet
for letter = ('A') to ('Z')
   ' Do something.
end for

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
STPendl
Full Member


Joined: 20 Aug 2007
Posts: 161
Location: Austria

PostPosted: Mar 10th, 2012, 9:55pm    Post subject: Re: Experiment - Multiple uses for the apostrophe Reply with quote

I like the block comment and the ability to use the ASCII value similar to C.

Haven't made my mind up about nested comments yet.

_________________
Stefan

Any code I post can be freely used, just give credit.


Last edited by STPendl on Mar 11th, 2012, 9:49am; edited 1 time in total
Back to top
View user's profile Send private message
Alyce
Full Member


Joined: 04 Jul 2005
Posts: 91

PostPosted: Mar 10th, 2012, 11:18pm    Post subject: Re: Experiment - Multiple uses for the apostrophe Reply with quote

Who are the potential users? Are they to be novice programmers, somewhat skilled, or experienced programmers?
_________________
- Alyce
Back to top
View user's profile Send private message Visit poster's website
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Mar 10th, 2012, 11:45pm    Post subject: Re: Experiment - Multiple uses for the apostrophe Reply with quote

Alyce, like most content on this site, VF's expected skill level is intermediate to advanced. Do you have any particular concerns?
_________________
Brent
Back to top
View user's profile Send private message Send e-mail
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Mar 10th, 2012, 11:55pm    Post subject: Re: Experiment - Multiple uses for the apostrophe Reply with quote

STPendl wrote:
Haven't made my mind up about nested comments yet.

One purpose would be to comment out chunks of code that contain block comments because simple blocks aren't nestable. Of course, all block comments could be made nestable, but then the lexer has to keep track of these.

Another purpose could be to parse these comments as XML, which might allow an external tool to auto-generate documentation.

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
Alyce
Full Member


Joined: 04 Jul 2005
Posts: 91

PostPosted: Mar 11th, 2012, 12:49am    Post subject: Re: Experiment - Multiple uses for the apostrophe Reply with quote

Brent wrote:
Alyce, like most content on this site, VF's expected skill level is intermediate to advanced. Do you have any particular concerns?


Not at all. My response would be different if you were aiming at novice programmers. I assumed you were targeting more experienced folks, but I wanted to be sure.

Nested levels of comments seems overkill, even for experienced coders, but I could see where it might be useful.

_________________
- Alyce
Back to top
View user's profile Send private message Visit poster's website
JosephE
Junior Member


Joined: 01 Nov 2007
Posts: 21

PostPosted: May 15th, 2012, 3:03am    Post subject: Re: Experiment - Multiple uses for the apostrophe Reply with quote

I would really like to see something similar to documentation comments similar to VB.NET's, minus the XML (which seems like over-kill to me). This would allow the IDEs to utilize intelligent code-completion on user created code libraries.

Code:

''' This is a documentation comment describing this boring function that
''' performs a rather redundant algorithm. Since this comment appears right
''' before the declaration, a good IDE should be able to use this in auto
''' complete
function DoSomething(param) ' or however functions are declared in VF
param = param
return param
end function
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Bay Six Software Forum Index -> ViviFire language All times are GMT
Page 1 of 1
Jump to:  
Quick Reply
Username:
Message:
   Shortcut keys: Alt+Q to activate, Alt+P to preview, Alt+S to submit
You can post new topics in this forum
You can 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



Lo-Fi Version
Powered by phpBB © 2001, 2005 phpBB Group