New topic: 

Parentheses and Optional Spaces Before and After Them

<http://forums.realsoftware.com/viewtopic.php?t=47947>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        barrytraver          Post subject: Parentheses and Optional 
Spaces Before and After ThemPosted: Wed May 22, 2013 9:52 am                    
     
Joined: Fri Sep 30, 2005 1:53 pm
Posts: 909
Location: Philadelphia, PA                In matters such as upper vs. lower 
case RB is rather flexible.  Almost anything will work  (in contrast, for 
example, to VB).

The same is ALMOST true in RB of whether you put a space (or not) to the left 
or right (or not) of a parentheses symbol.

Thus ALL of the following work in RB (which doesn't really care which of you 
use):

Dim Day(07)As String
Day(1)="Sunday"
Day (2)="Monday"
Day( 3 )="Tuesday"
Day(4 )="Wednesday"
Day(5) ="Thursday"
Day (6) = "Friday"
Day ( 7 ) ="Saturday"

MsgBox Day(1)
MsgBox Day ( 2)
MsgBox Day(3 )
MsgBox Day( 4 )
MsgBox Day ( 5)
MsgBox Day ( 6)
MsgBox Day (7 )

Dim Month ( 12 ) As String
Month(1) = "January"
//  etc.
  
Actually, since in the preceding example you can put a space or not in four 
possible positions (i.e., before the first parenthesis, after the first 
parenthesis, before the second parenthesis, after the second parnhesis), there 
are 2 x 2 x 2 x 2 or 16 possible ways of putting or not putting a space, ALL of 
which RB allows.

That's great.  Some people complain that RB is not more restrictive in its 
requirements, but there is something to be said for letting the programmer 
decide on the practice he or she prefers.

I do have a minor complaint, however.  I am one of the people who prefer lots 
of "white space" for readability. Thus my preference would be, for example, 
"Dim Day ( 7 ) As String" rather than, say, "Dim Day(7)As String".  RB lets me 
do have that option ALMOST ALL the time, but (for some reason of its own) NOT 
ALL the time.  There is one (and only one) exception that I know of. 

In particular, RB does NOT allow "white space" when it comes to the parentheses 
you use when you define a property.  "Day(7)" with no spaces is allowable, but 
"Day (7 )" with spaces is not,

Three questions: (1) Why is Real Software inconsistent in its requirements in 
that one (and only one) situation?  (2) Does the documentation mention that 
inconsistency? (3) Is there any hope of persuading Real Software of removing 
the inconsistency and of allowing programmers to have the same choice they have 
everywhere else concerning parentheses and spaces?

Yes, I did spend a lot of time figuring out that RB in that single situation 
did NOT allow what I was allowed EVERYWHERE ELSE.  (Curiously enough, I was 
allowed the space when making a Dim statement; see above).

Barry Traver   
                             Top                Jason_Adams          Post 
subject: Re: Parentheses and Optional Spaces Before and After ThemPosted: Wed 
May 22, 2013 9:58 am                                 
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1835
Location: Michigan, USA                I can honestly say I've never dealt with 
this, as I tend to only use spaces within events/methods. Since I'm only 
looking at a single line at a time while viewing properties, I've never had an 
issue with readability. But if that's important to you, I'd suggest filing a 
feedback, then putting the link here so others can join on if it's important to 
them.     
_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to