=> operator
-
- Posts: 606
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
=> operator
I see by remarks that this is a part of FB since 0.90
I see that it is used in code examples at times, but then cannot find it in the operator list.
I see it as a note, for example, on:
http://www.freebasic.net/wiki/wikka.php ... Assignment
If this is a valid, distinctive operator, then I feel it should have listings and a page of its own, or listed under syntax and usage at the top of the page referenced above, and put into the operator list page:
http://www.freebasic.net/wiki/wikka.php ... tPgOpIndex
I already feel old. When I can't find something, I question whether it is my eyes or my brain that is failing faster.
david
edit:
I think this should apply to the member access operator shorthand '->' also and any other valid keystroke combinations, especially if they are used in code examples on the wiki. A person - especially someone new and learning, should be able to find any keyword in any example just using either the operator list or the keyword list, without going through layers of pages to find an explanation.
I see that it is used in code examples at times, but then cannot find it in the operator list.
I see it as a note, for example, on:
http://www.freebasic.net/wiki/wikka.php ... Assignment
If this is a valid, distinctive operator, then I feel it should have listings and a page of its own, or listed under syntax and usage at the top of the page referenced above, and put into the operator list page:
http://www.freebasic.net/wiki/wikka.php ... tPgOpIndex
I already feel old. When I can't find something, I question whether it is my eyes or my brain that is failing faster.
david
edit:
I think this should apply to the member access operator shorthand '->' also and any other valid keystroke combinations, especially if they are used in code examples on the wiki. A person - especially someone new and learning, should be able to find any keyword in any example just using either the operator list or the keyword list, without going through layers of pages to find an explanation.
Re: => operator
It is documented on the DIM page as an alternate for the = assignment operator, but the wording is strange, "the => sign" and "the (=) equal sign", and there is no mention of the word "operator". It is an operator, so it should be documented as such.
Re: => operator
For a long time, "=>" can be used instead of "=" in declaration initializers, but in that case, it is more an initialization sign that the assignment operator (for example '= Any' or '=> Any' can be also used as initializer).
Recently it has been authorized in assignment expressions to solve the parser ambiguity in some cases (for example: reference assignment from a byref function with one parameter).
"=>" is not equivalent to '=" because for example it cannot be used as operator equal when comparing two expressions.
Recently it has been authorized in assignment expressions to solve the parser ambiguity in some cases (for example: reference assignment from a byref function with one parameter).
"=>" is not equivalent to '=" because for example it cannot be used as operator equal when comparing two expressions.
-
- Posts: 606
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
Re: => operator
Exactly, fxm.
However, locating an explanation in the wiki is, at the least, difficult.
I admire your depth of understanding of all the details of FB. However, sometimes it is difficult to follow your clarifications and explanations when I can't find the symbols you use to make a point more clear. You DO make it work, though.
Most often, it is these ambiguities in the parser that force uncomfortable methods of presenting precise code to the parser.
The multiple and what should be superfluous extra parenthetical braces to distinguish UDT, members and type references look to never be explained in any place clear enough that one could just sit and study and understand. (Those extra ()()(()) drive me nuts!)
I'm old and slower than I used to be, and when you and others begin adding extra (()) around statements to fix the parsing ... it reminds me of c and c++ and the famous '= vs ==' error that took so long to catch. That is too much work to understand a BASIC program. How can someone support that solution in the future?
Anyway, an entry in the operators list would get me and others started when we see them.
Thank you
david
However, locating an explanation in the wiki is, at the least, difficult.
I admire your depth of understanding of all the details of FB. However, sometimes it is difficult to follow your clarifications and explanations when I can't find the symbols you use to make a point more clear. You DO make it work, though.
Most often, it is these ambiguities in the parser that force uncomfortable methods of presenting precise code to the parser.
The multiple and what should be superfluous extra parenthetical braces to distinguish UDT, members and type references look to never be explained in any place clear enough that one could just sit and study and understand. (Those extra ()()(()) drive me nuts!)
I'm old and slower than I used to be, and when you and others begin adding extra (()) around statements to fix the parsing ... it reminds me of c and c++ and the famous '= vs ==' error that took so long to catch. That is too much work to understand a BASIC program. How can someone support that solution in the future?
Anyway, an entry in the operators list would get me and others started when we see them.
Thank you
david
Re: => operator
What's the best solution for documentation:
- create a new page
- or precise that "=>' is an alias (since fbc 0.90) of "=" for the operator assignment usage.
I would advocate instead the second solution:
1) Page KeyPgOpAssignment:
'= (Assignment)'
by:
'=[>] (Assignment)'
CatPgOpIndex
CatPgOpAssignment
CatPgFunctIndex
KeyPgLet
KeyPgOpEqual
KeyPgOpLet
KeyPgOpLetlist
3) Update the text (Usage, Description) in page KeyPgOpLet.
4) Update the text (Syntax) in page KeyPgOpLetlist
5) Update the table (Highest Precedence) in page OpPrecedence
[edit]
Replaced '= or =>' by '=[>]'
- create a new page
- or precise that "=>' is an alias (since fbc 0.90) of "=" for the operator assignment usage.
I would advocate instead the second solution:
1) Page KeyPgOpAssignment:
2)Change in all links the text:Operator =[>] (Assign)
------------------------------------------------------
Assigns a value to a variable
Syntax:
declare operator Let ( byref lhs as T1, byref rhs as T2 )
Usage:
lhs = rhs
or
lhs => rhs (from fbc version 0.90)
or, in the QB dialect,
[ Let ] lhs = rhs
or
[ Let ] lhs => rhs (from fbc version 0.90)
.....
'= (Assignment)'
by:
'=[>] (Assignment)'
CatPgOpIndex
CatPgOpAssignment
CatPgFunctIndex
KeyPgLet
KeyPgOpEqual
KeyPgOpLet
KeyPgOpLetlist
3) Update the text (Usage, Description) in page KeyPgOpLet.
4) Update the text (Syntax) in page KeyPgOpLetlist
5) Update the table (Highest Precedence) in page OpPrecedence
[edit]
Replaced '= or =>' by '=[>]'
Last edited by fxm on Sep 29, 2015 21:26, edited 7 times in total.
-
- Posts: 2958
- Joined: Jun 02, 2015 16:24
Re: => operator
Nothing bad with your astonishment for me, I've made some remark about this some times ago : http://www.freebasic.net/forum/viewtopi ... 41#p211462.speedfixer wrote:I see by remarks that this is a part of FB since 0.90
Sincerely fxm, I would create anyway a page and its own link, where it is indicated that this is an alternative to = for assignement only, and give here the restrictions (not an overloadable operator) and the recommanded/usual usage (first assignation/initialization). So to summarize, the points that are interesting to learn :fxm wrote:What's the best solution for documentation:
- create a new page
- or precise that "=>' is an alias (since fbc 0.90) of "=" for the operator assignment usage.
- what is this sign, an alternate sign for assignement
- version of introduction
- why is this not classically oriented from right to left (see dkl remark, ':' was already in use)
- is this equivalent to = ? ---> not, so what are the restrictions compared to =
- what is it used for ? ---> assignation/ initialization/ substitute to = in the case of possible confusion with '=='
- any example of confusion with '==' would be welcome
- any example of usage is in fact welcome
My concern is that calling it an alias is still confusing a little since it is not an alias for all usages, it has restrictions.
Whatever, any addition is always a good step forward. Thanks by advance.
Re: => operator
Tourist Trap wrote:
- why is this not classically oriented from right to left (see dkl remark, ':' was already in use)
fxm wrote:In FreeBASIC, there is also the operator <= (Less Than Or Equal).
Re: => operator
But how it would link this new page in the different catalog-pages and in the different keyword-pages?Tourist Trap wrote:I would create anyway a page and its own link, where it is indicated that this is an alternative to = for assignement only, and give here the restrictions (not an overloadable operator) and the recommanded/usual usage (first assignation/initialization).
Two links for the same function (WEIRD)?
- = (Assignment)
- => (Assignment's alias)
Last edited by fxm on Sep 26, 2015 19:16, edited 3 times in total.
Re: => operator
See my updated proposal post:
http://www.freebasic.net/forum/viewtopi ... 32#p211732
http://www.freebasic.net/forum/viewtopi ... 32#p211732
-
- Posts: 606
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
Re: => operator
I do like the square brackets indicating optional usage.
I would prefer NOT adding more pages than needed. No need to add to difficulty of maintenance. If there is little or no distinction in usage, not extra page is required. There are already at least 4 pages regarding assignment.
As long as someone can see the keystrokes on a list, and can find the reference and explanation, that should be satisfactory.
david
I would prefer NOT adding more pages than needed. No need to add to difficulty of maintenance. If there is little or no distinction in usage, not extra page is required. There are already at least 4 pages regarding assignment.
As long as someone can see the keystrokes on a list, and can find the reference and explanation, that should be satisfactory.
david
Re: => operator
Obviously I agree because this is what I have proposed:
- In summary, '=' and '=>' are now equivalent for the assignment and initialization functions (I already spotted all links of the pages to modify).
- Only '=' is allowed for the equality comparison (everywhere 'Operator = (Equal)' must not be modified).
Admin, are you in favor that I do the update in this way?
- In summary, '=' and '=>' are now equivalent for the assignment and initialization functions (I already spotted all links of the pages to modify).
- Only '=' is allowed for the equality comparison (everywhere 'Operator = (Equal)' must not be modified).
Admin, are you in favor that I do the update in this way?
Re: => operator
What is the dead line for documentation update to be integrated in the next release?fxm wrote:Admin, are you in favor that I do the update in this way?
-
- Posts: 2958
- Joined: Jun 02, 2015 16:24
Re: => operator
I didn't know this. That's only if the operator LET was not allowed to be overload for => that I would have liked another page because this would have been a very important difference. Else, I agree for naming it an alias, or melting it in the = page mentioning that this is not equality.fxm wrote: '=> (Assignment)' as '= (Assignment)' are both overloadable through the Operator Let.
You
Out of subject or extending it, what about introducing the '==' sign as alternate for equality? So doing one could get rid of any ambiguity all the time. I'm thinking about someone who would teach freebasic for example at school for an introduction to programming and would prefere avoid this difficulty. Just a question, not a request.
Re: => operator
Yes, allow an alias for the equality operator:
'Operator =[=] (Equal)'
is interesting!
'Operator =[=] (Equal)'
is interesting!
Re: => operator
If it's ready by (roughly) 2015-10-01 12:00 UTC, then it will be in the release.
It's good to have => documented next to = (assignment). I'd put it on the same page, as alternative syntax, and explain when/why it's useful. Adding information about why it's => and not <= or := is good too.
It's good to have => documented next to = (assignment). I'd put it on the same page, as alternative syntax, and explain when/why it's useful. Adding information about why it's => and not <= or := is good too.