Would an Assign operator be useful #51
Replies: 6 comments 4 replies
-
Beta Was this translation helpful? Give feedback.
-
|
I can see where you are coming from but I think that its the totally wrong perspective for twinBasic. Removing the option to have default members would break a lot of VBA code. I use it extensively for the Item method, or if I don't have an item method, the factory constructor to avoid having to 'New' things. With the Operator/Method proposal, its introduction doesn't change how existing code works. BUT is is just a quality of life thing. If I wanted to to quote an analogy it would that that adding one more wart to a warty thing doesn't resolve the wartiness, but at least the Warts now have a more aesthetic pattern. |
Beta Was this translation helpful? Give feedback.
-
|
For the record I agree that removing would create more problem and wasn't serious about it. Still, there's a reason why "do no harm" is the first thing on the hippo oath. :) |
Beta Was this translation helpful? Give feedback.
-
|
I'm kind of torn on this suggestion. While I can appreciate syntactic sugar as much as the next sweetness addict, I'd be concerned that those pesky Beginners I'm always harping about might get more confused (at least visually) between your proposed "<-" operator and the pre-existing "<=" logical comparison operator. I'd think that the statement form would be "more 'basic-y'" (wow, talk about a new construct in languages, there's one). After all, we've been seeing that original construct pattern literally forever in VBx to date, and other than being a tad tiresome to read over and over, what's the harm? (and then there's Ben's/XKCD's point to consider.) |
Beta Was this translation helpful? Give feedback.
-
|
I put the suggestion forward because I've been using the following Which seems to work most of the time. However I must be missing something because it doesn't work ALL the time. If we followed the Mantra of 'forever in VBx to date,' we wouldn't have the new return statement, nor the AndAlso and OrElse, the new if statement etc etc etc. So, given that I can almost achieve what I want in Standard VBA I thought it would be a reasonable idea to put forward. The fact that this hasn't already been implemented by Wayne makes me think there may be snags in the background I'm not aware of. So, it may be a small thing, but lots of small things makes a big difference. |
Beta Was this translation helpful? Give feedback.
-
|
Set varA = varB would raise runtime error if varB is not a reference. Does any code depend on such runtime error? Why not silently succeed? Another option would be inteoduce a new keyword Let, Set so Wet probably or overload an existing obscure keyword like LSet working now for Variants (instead of UDTs only) |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
In VBA we have the awkward boilerplate of
twinBasic has made great strides by eliminating this construct by
• Introduction of Generics
• the return statement
Other authors use the various variant copy methods
Given all of the above I'm wondering if there any possibility of eliminating the above boilerplate by introducing a new method or operator.
e.g. as Operator
or as Method
Beta Was this translation helpful? Give feedback.
All reactions