[futurebasic] Re: [FB] Three elementary questions

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 2004 : Group Archive : Group : All Groups

From: Jay Reeve <jayreeve@...>
Date: Fri, 13 Aug 2004 10:08:07 -0500
On Friday, August 13, 2004, at 09:49  AM, Richard Goodman wrote:

> I've been studying some of the graphics examples supplied with FB.
>
> I have three questions about symbols:
>
> 1) In the following statement, what is the purpose of the carat ^ 
> before
> CGrafPort?
> DIM @ drawGW  as  ^CGrafPort
The caret is short hand for "pointer to." It means the var drawGW will 
hold the address of the CGrafPort, rather than being the port itself.

These statements are all equivalent:
DIM @ drawGW  as  pointer to CGrafPort
DIM @ drawGW  as  ptr to CGrafPort
DIM @ drawGW  as  ^CGrafPort
DIM @ drawGW  as  .CGrafPort

> 2) Why is does the double equal sign (==) exist. According to the Ref.
> Manual, it is equivalent to a single = sign.
> Here is a statement where I found it:
>
> LONG IF FN LockPixels( FN GetGWorldPixMap( drawGW ) ) == _false
Two reasons. First, it helps to distinguish the comparison from the 
assignment symbol. Second, I think it corresponds to the syntax in some 
other languages, making FB a bit more versatile.

> 3) Also, why is there a second symbol for inequality: != in addition 
> to <>?
Again, the != corresponds to some other languages, and is more 
obviously related to equality than the obscure <>.

> Are the last two symbols created to confound the newbies?
Ah, you've seen through Staz's scheme. Isn't that the goal of all good 
programming languages? :-)

Actually, it's all about flexibility and choices. Some (like myself) 
prefer to stick with the old <>. Others (Robert Purves for example) 
like the newer !=. What would a language be with no synonyms?

  e-e
  =J= a  y
   "

--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...